Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Re: Re: question mark in there

by chipmunk (Parson)
on Dec 12, 2000 at 22:23 UTC ( [id://46290]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: question mark in there
in thread question mark in there

I was skeptical about this warning, and a simple experiment shows that it is not accurate:
DB<1> $x = '???\E???' DB<2> p "\Q$x" \?\?\?\\E\?\?\? DB<3>
A \Q cannot be ended by a \E in an interpolated string. And, using B::Deparse's -q option in 5.6, we can see why:
~> perl -MO=Deparse,-q -e '$x = q{?\E?}; $y = "a\Q$x\Eb"; print "$y\n" +' $x = '?\\E?'; $y = quotemeta $x; print $y . "\n"; -e syntax OK
This shows that \Q\E inside a double-quoted string is actually compiled as concatenation and quotemeta. The value of $x at runtime won't change the scope of the quotemeta().

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://46290]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (1)
As of 2024-04-25 00:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found