Beefy Boxes and Bandwidth Generously Provided by pair Networks Frank
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Interpolating $1 within a variable

by CharlesClarkson (Curate)
on Oct 28, 2001 at 11:21 UTC ( #121803=note: print w/ replies, xml ) Need Help??


in reply to Interpolating $1 within a variable

Er, I'm confused:

$_ = q(ab cdefg); $x = q($1,); s/(^\w+)/qq("$x")/ee; print;
produced:
ab, cdefg

What do you mean by: it worked!, but unfortunately puts "" around regular strings. Any suggestions on how I can interpolate $1 inside of a variable with out any side effects similar to qq("")? What side effects?

Charles K. Clarkson


Comment on Re: Interpolating $1 within a variable
Download Code
Re: Interpolating $1 within a variable
by s0ttle (Scribe) on Oct 29, 2001 at 14:43 UTC
    What I meant was that when $x=q(ab,); the output was: "ab," cdefg
    but I found out why it was doing this. I had forgotten to add the extra /e and so I kept running:
    perl -le '$_=q(ab cdefg);$x=q(ab,);s/(^\w+)/qq("$x")/e;print;'
    But the problem is fixed now. Thank you monks.

    -tengo mas que aprender

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (13)
As of 2014-04-18 21:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (472 votes), past polls