On Wed May 28 09:22:22 2008, david@kineticode.com wrote: > When I run this code: > > my @a = map { "--$_" => $_ } @ARGV; > > I get this compile-time error: > > Not enough arguments for map at /Users/david/bin/try line 6, near "} > @ARGV" > syntax error at /Users/david/bin/try line 6, near "} @ARGV" > Execution of /Users/david/bin/try aborted due to compilation errors. Because Perl thinks you are constructing an anonymous hash. If you disambiguate, it figures it out: my @a = map {; "--$_" => $_ } @ARGV; Note the semicolon. (Pardon the double-submit, but I forgot to CC p5p on the first go.)Thread Previous | Thread Next