develooper Front page | perl.beginners | Postings from February 2002

[Q] How can I pass Perl variables into shell?

Thread Previous | Thread Next
From:
Bhanu Prakash
Date:
February 21, 2002 23:05
Subject:
[Q] How can I pass Perl variables into shell?
Message ID:
20020222070515.70630.qmail@web11807.mail.yahoo.com
Hi, 
Can I not do something like...

#!/usr/local/bin/perl 
use strict;
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?
Can I pass $myname to awk?
Thanks
Bhanu


__________________________________________________
Do You Yahoo!?
Yahoo! Sports - Coverage of the 2002 Olympic Games
http://sports.yahoo.com

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About