Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Unwanted interpolation in backquoted string

by coec (Chaplain)
on May 04, 2004 at 06:46 UTC ( [id://350249]=note: print w/replies, xml ) Need Help??


in reply to Unwanted interpolation in backquoted string

Something like
open(FILE, $file) or die "$!"; my @file = <FILE>; close(FILE); foreach (@file) { if (m/$val[0]/) { $tmp = (split /\s+/,$_)[1]; print $tmp . "\n"; } }

but the actual problem with the back quotes is that $2 should be escaped. (s/$2/\$2/) The reason is that you want awk to interpret $2, not Perl.

CC

Note that this is completely untested...

Replies are listed 'Best First'.
Re: Re: Unwanted interpolation in backquoted string
by Anomynous Monk (Scribe) on May 04, 2004 at 17:15 UTC
    I think you mean s/\$2/\\\$2/ :)
      Doh!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2024-04-19 23:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found