New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
map { "$_", 1} @array is syntax error #2872
Comments
From Bruce.Albrecht@fingerhut.comCreated by bruce.albrecht@fingerhut.comI was trying to do This is also broken in 5.005.03. Perl Info
|
From @tamiasOn Fri, Nov 17, 2000 at 11:01:07AM -0600, Bruce Albrecht wrote:
Thank you for your report. This is actually a known issue. With the advent of anonymous hash references, Perl has to determine whether Because Perl doesn't look ahead to the closing brace, it has to guess. If One workaround is to use parens, as you found. Another is to put a plus Because the workarounds are so simple, this bug does not have a high Ronald |
From [Unknown Contact. See original ticket]Lightning flashed, thunder crashed and Ronald J Kimball <rjk@linguist.dartmouth Another fix for this specific instance is to use lc($_) instead of "\L$_". -spp |
From @nwc10On Fri, Nov 17, 2000 at 01:27:52PM -0500, Stephen P. Potter wrote:
but currently it's not documented as a trap. maybe I went a bit over the *** pod/perlfunc.pod.orig Tue Nov 14 18:56:07 2000 map(lc($_),1),@foo versus map+(lc($_),1),@foo starts to look like something Nicholas Clark |
From @jhiOn Fri, Nov 17, 2000 at 10:10:28PM +0000, Nicholas Clark wrote:
Applied, thanks. |
From @ysthIn article <20001117221028.A88930@plum.flirble.org>,
You left out my favorite! Inline Patch--- pod/perlfunc.pod.orig Sat Nov 18 22:49:02 2000
+++ pod/perlfunc.pod Sun Nov 19 12:11:24 2000
@@ -2495,7 +2495,8 @@
%hash = map { "\L$_", 1 } @array # perl guesses EXPR. wrong
%hash = map { +"\L$_", 1 } @array # perl guesses BLOCK. right
%hash = map { ("\L$_", 1) } @array # this also works
- %hash = map { lc($_), 1 } @array # as does this.
+ %hash = map { lc($_), 1 } @array # as does this
+ %hash = map {; "\L$_", 1 } @array # and this.
%hash = map +( lc($_), 1 ), @array # this is EXPR and works!
%hash = map ( lc($_), 1 ), @array # evaluates to (1, @array)
End of Patch. |
From @nwc10On Sun, Nov 19, 2000 at 12:13:57PM -0800, Yitzchak Scott-Thoennes wrote:
that's quite nifty :-)
I also verified (after inspecting the code in toke.c) that having a literal Nicholas Clark |
Migrated from rt.perl.org#4723 (status was 'resolved')
Searchable as RT4723$
The text was updated successfully, but these errors were encountered: