News for hackers. Stuff that matters.
Re:How Perl Saved the Human Genome Project (1996) by kbenson on Sunday May 05, 2013 @04:35AM (#5657850)
This is really not much of an issue, if you bother to learn the language. If you don't, then yes, things will be confusing.

    sub named_params {
      my %P = @_; # named params in hash %P
      my $foo = $P{bar} + $P{baz};
      return $foo * $P{multiplier};
    }
    
    my $rvalue = named_params( foo => 1, bar => 2, multiplier => 3 );
Or, some people prefer to just pass in a hash reference:

    sub named_params_hashref {
      my $P = shift;
      my $foo = $P->{bar} + $P->{baz};
      return $foo * $P->{multiplier};
    }
    my $rvalue = named_params_hashref({
      foo => 1,
      bar => 2,
      multiplier => 3,
    });
But of course, why bother letting common sense, and a single line of code stand in the way of your chance to deliver a pithy remark?

There are no comments on this comment yet.