On Feb 21, Bhanu Prakash said: >my $myname='hi There'; >system "ls","-la"; >system "echo","$myname"; >qx{awk '{ if ($myname==$1) { do something } else print >$2,$1 }'}; > >My script is complaining about uninitialized >variables.. >I suspect it is talking about $1 and $2s .Can I not >place them here?
Backslash the $ signs. qx{ awk '{ if ($myname == \$1) { ... } else print \$2, \$1 }' }; >Can I pass $myname to awk? Well, you can interpolate $myname in the qx{}, but you might want to quote it: qx{ awk '{ if ("$myname" == \$1) { ... } else print \$2, \$1 }' }; -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look for "Regular Expressions in Perl" published by Manning, in 2002 ** <stu> what does y/// stand for? <tenderpuss> why, yansliterate of course. [ I'm looking for programming work. If you like my work, let me know. ] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]