[LA.pm] Usage of =>
John Beppu
john.beppu at gmail.com
Thu Feb 2 01:00:27 PST 2006
Hey Robin,
=> is a glorified comma that quotes the bareword that precedes it.
Therefore ('key', 'value') is equivalent to (key => 'value'). If you
want to write a sub that can accept named parameters, you'd usually do
something like this:
sub foo {
my %param = @_
print "x is $param{x}; y is $param{y}\n";
}
foo(x => 8, y => 16);
On 2/2/06, Robin Rowe <rower at movieeditor.com> wrote:
> Is there a good doc somewhere on the usage of => for named parameters in
> subroutines?
>
More information about the Losangeles-pm
mailing list