in reply to order in map
{ 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 its dealing with based 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 + to give perl some help
This will parse correctly, forcing BLOCK:
my %hash = map {+ qq(stuff_$_) => $_ } qw(asdf qwert zxcv)
"There are only two truly infinite things. The universe and stupidity, and I'm not too sure about the universe"- Albert Einstein
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: order in map
by suaveant (Parson) on May 02, 2005 at 19:48 UTC |