in reply to Re^2: " - " in the syntax
in thread " - " in the syntax
Gives (as expected):use strict; use warnings; use Data::Dumper; my %a = (-keys => 'v1', -values => 'v2'); print Dumper(\%a);
keys and values are (of course) builtins. When I replace the 'fat comma' with an ordinary one:$VAR1 = { '-keys' => 'v1', '-values' => 'v2' };
I get:my %a = (-keys , 'v1', -values , 'v2');
It was the fat comma doing the stringification, not the -.Not enough arguments for keys at C:\gash.pl line 6, near "keys ," Not enough arguments for values at C:\gash.pl line 7, near "values ,"
Gives:my %a = (-xkeys , 'v1', -xvalues , 'v2');
Which I guess means it is not a good idea to rely on - to do stringification.$VAR1 = { '-xvalues' => 'v2', '-xkeys' => 'v1' };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: " - " in the syntax
by Anonymous Monk on Mar 06, 2009 at 10:50 UTC | |
by cdarke (Prior) on Mar 06, 2009 at 12:04 UTC |