News for hackers. Stuff that matters.
Re:Why I like Java by draegtun on Thursday February 06, 2014 @04:49AM (#7189531)
It's only a surprise if you don't understand it. Every Perl programmer needs to fully grok and embrace it because it's a core language feature.

For others, this is what EdwardDiego is referring to:

  my %hash = (a => 1, b => 2, c => 3, d => 4);

  # list context (plural)
  my @keys = keys %hash;
  my ($key1, $key2, @rest_of_keys) = keys %hash;
  
  # scalar context (singular)
  my $number_of_keys = keys %hash;
  say scalar keys %hash;

  # An example of iterator usage
  my ($first_key, $first_value) = each %hash;
  my ($second_key, $second_value) = each %hash;

  # void context
  keys %hash;    # resets iterator

There are no comments on this comment yet.