rlk has asked for the wisdom of the Perl Monks concerning the following question:
The original code looked like this:
However, this raises a syntax error. Some further testing revealed thatmap {1,$_} @foo
and, somewhat more surprisinglymap {(1,$_)} @foo
both work as expected (i.e, return the elements of @foo interlaced with ones)map {$_,1} @foo
To further confuse the issue, this error cropped up several times in a set of otherwise completely functional scripts, leading me to wonder if this is a change (/me avoids using the word "bug") in 5.6, which I believe the scripts predate. Any thoughts?
--
Ryan Koppenhaver, Aspiring Perl Hacker
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Syntax question with
by merlyn (Sage) on Jan 02, 2001 at 09:15 UTC | |
|
Re: Syntax question with
by repson (Chaplain) on Jan 02, 2001 at 11:05 UTC | |
|
Re: Syntax question with
by I0 (Priest) on Jan 02, 2001 at 09:09 UTC |