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!