Do you know where your variables are? | |
PerlMonks |
Re: [closed] map sentence as array slice indexesby Discipulus (Canon) |
on Nov 25, 2015 at 12:09 UTC ( [id://1148598]=note: print w/replies, xml ) | Need Help?? |
Hello, in the docs for map i read: { starts both hash references and blocks, so map { ... could be either the start of map BLOCK LIST or map EXPR, LIST. Because Perl doesn't look ahead for the closing } it has to take a guess at which it's dealing with based on what it finds just after the {. Usually it gets it right, but if it doesn't it won't realize something is wrong until it gets to the } and encounters the missing (or unexpected) comma. The syntax error will be reported close to the }, but you'll need to change something near the { such as using a unary + or semicolon to give Perl some help:So you need to help Perl doing the right guess, using a plus sign (and parentheses!):
HtH L*
There are no rules, there are no thumbs.. Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
In Section
Seekers of Perl Wisdom
|
|