-
Notifications
You must be signed in to change notification settings - Fork 556
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
Bug in magic locals vs block loops? #1101
Comments
From Tim_Peters@Dragonsys.com it don't with block while under $ perl -v I understand that $1 etc are magically local to blocks. However, the Bug or (incomprehensible <wink>) feature? looks-like-a-bug-to-me-ly y'rs - tim $var = "it works or it don't"; $var =~ /(don't)/; # set $1 to "don't" $var =~ /(don't)/; $var =~ /(don't)/; $var =~ /(don't)/; $var =~ /(don't)/; $var =~ /(don't)/; |
From @TimToadyTim_Peters@Dragonsys.com writes: Not that Perl doesn't have its share of incomprehensible features, but On the other hand, since the buglette is related to the optimization of Plus nowadays there's a bit of a magical lexical scope around entire $wink = "y'rs\n"; You'll find that it prints "wink-ly y'rs", despite the fact that the Mind, I'm not promising we won't fix it. I don't make promises like that. :-) : looks-like-a-bug-to-me-ly y'rs - tim Nice to hear from you after your long sojourn in snake-strewn lands! Larry |
From @tamiasOn Fri, Jan 28, 2000 at 06:10:28PM -0800, Larry Wall wrote:
Coincidentally, I happened to stumble across this quirk earlier today while until ($line =~ /regex/) { This could have been simplified to: until ($line =~ /regex/) { were it not for this behavior. And no !~ in the loop conditional, either. Ronald |
From [Unknown Contact. See original ticket][Larry Wall graciously allows]
Thanks for confirming that my years of slavery to that other P language
That was my first thought too (I didn't write the original code, just helped
As another followup noted, and as another part of the test case showed, the until (<> =~ /$interesting/o) { is really quite natural! It was only relative lack of Perl experience that while (<> !~ /$interesing/o) ... form.
While tempted to accuse you of blatant misdirection here <wink>, I agree --
It proved easy to work around (just do explicit assignment to a "real vrbl"
Nice, too, to be heard. Thanks for your insights here, Larry! i-only-hang-out-with-pythons-cuz-the-pay-is-so-good<wink>-ly y'rs - tim |
From @RandalSchwartz
Ronald> Coincidentally, I happened to stumble across this quirk earlier today while Ronald> until ($line =~ /regex/) { Ronald> This could have been simplified to: Ronald> until ($line =~ /regex/) { Ronald> were it not for this behavior. And no !~ in the loop conditional, either. See, that's where I hate logic like this, and start creating my own { There, nice and handy. And even nearly the same number of lines. And while (<>) { There. Very clean, no bugs visible. :) -- |
From [Unknown Contact. See original ticket]"Randal L. Schwartz" wrote:
I suppose the redo is a camouflaged next, then? -- |
From @RandalSchwartz
Rick> "Randal L. Schwartz" wrote:
Rick> I suppose the redo is a camouflaged next, then? oops. Yes, "next". -- |
Migrated from rt.perl.org#2055 (status was 'resolved')
Searchable as RT2055$
The text was updated successfully, but these errors were encountered: