develooper Front page | perl.perl5.porters | Postings from November 2012

Re: [perl #115834] Successfull match $_[0]=~ /foo(.+)/ overrides $_[0] if function called as foo($1)

From:
Ed Avis
Date:
November 26, 2012 02:16
Subject:
Re: [perl #115834] Successfull match $_[0]=~ /foo(.+)/ overrides $_[0] if function called as foo($1)
Message ID:
loom.20121126T111228-392@post.gmane.org
Jesse Luehrs <doy <at> tozt.net> writes:

>This is just a side effect of how $1 works in general - any assignments
>to capture variables (via a successful match) are implicitly localized:

>The current behavior is the only thing that actually makes sense, given
>the combination of behaviors in this example and the previous one I
>gave. I do agree that it's fairly confusing, but I really don't know
>what a better solution to this could possibly be.

I suggest that if we are stuck with the current behaviour, there should be a
warning on calls like foo($1).

-- 
Ed Avis <eda@waniasset.com>






nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About