Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
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

Replies are listed 'Best First'.
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?
[Discipulus]: but the best i attended live was Mano Negra Patchanka at Forte Prenestino .. in 1990
[Corion]: Hmmm - Mano Negra or at least Manu Chao seem to put on a good live show. At least the one live CD I have from Manu Chao sounds good ;)
Discipulus feels the same jealousity of the johngg's daughter
[1nickt]: choroba I agree
[choroba]: Playing in a punk rock band for 20 years... my hearing is quite bad
[Corion]: I still have hopes to turn my godson and his two siblings into a punk band ;)
[Corion]: Their older sister just started piano but has been interested in drumming, which she should be able to start with 8 years or so)
[Discipulus]: ah was Kink of Bongo 1992..
[1nickt]: choroba name of band? youtube link? MySpace link?

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (9)
As of 2017-03-24 12:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (301 votes). Check out past polls.