develooper Front page | perl.perl5.porters | Postings from March 2003

Re: [perl #21744] Deparse bug: "\::" deparsed as "::"

Thread Previous
From:
Stephen McCamant
Date:
March 29, 2003 15:17
Subject:
Re: [perl #21744] Deparse bug: "\::" deparsed as "::"
Message ID:
16006.10593.227746.467356@syllepsis.MIT.EDU
>>>>> "EA" == Enache Adrian <enache@rdslink.ro> writes:

EA> On Sat, Mar 29, 2003 at 06:50:55PM +0200, I wrote:
EA> -	    || ($last =~ /^[{\[\w_]/ &&
EA> +	    || ($last =~ /^[:{\[\w_]/ &&

EA> And <'> should be probably there too.
EA> -	    || ($last =~ /^[:{\[\w_]/ &&
EA> +	    || ($last =~ /^[:'{\[\w_]/ &&

EA> $ perl -MO=Deparse
EA> "${a}'b"
EA> ^D
EA> "$a'b";

EA> which perl will parse as $a::b ...

Yes. It might be better to write the regex as (['\[{\w_]|::), since a
single colon doesn't trigger interpretation as a variable, but
generally this is a context where it's better to err on the side of
adding the curlies rather than not.

 -- Stephen

Thread Previous


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