perlquestion
rlk
I'm hesitant to post an "did I find a bug in perl?" type question, but I ran across a snippet of code yesterday that has caused me some confusion.<p>
The original code looked like this:
<code>
map {1,$_} @foo
</code>
However, this raises a syntax error. Some further testing revealed that
<code>
map {(1,$_)} @foo
</code>
and, somewhat more surprisingly
<code>
map {$_,1} @foo
</code>
both work as expected (i.e, return the elements of @foo interlaced with ones)
<p>
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?
<p>--<br>
Ryan Koppenhaver, Aspiring Perl Hacker<br>
</p>