The => operator is a synonym for the comma except that it causes its left operand to be interpreted as a string if it begins with a letter or underscore and is composed only of letters, digits and underscores. This includes operands that might otherwise be interpreted as operators, constants, single number v-strings or function calls. If in doubt about this behavior, the left operand can be quoted explicitly.
=> treats the dash as a string, although the doc does not mention it:
use warnings; use strict; use Data::Dumper; my %h = (-v => 5); print Dumper(\%h); print "$h{-v}\n"; __END__ $VAR1 = { '-v' => 5 }; 5
In reply to Re^2: Understanding arguments to subroutines
by toolic
in thread Understanding arguments to subroutines
by uday_sagar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |