Michael Norris wrote at Tue, 11 Jun 2002 22:30:25 +0200:
> I'm trying to place a variable in the spot of an argument when exectuting a command
>with "open."
> Here's what I'm trying to do.
>
> open(COMMAND,"home/usr/usrname command $argument|");
> while (<COMMAND>)
> print "$_"; #print output
I tried the snippet:
my $arg = "-a";
open CMD, "ls $arg |" or die "Cant open $!";
while (<CMD>) {
print $_;
}
and checked whether I'll get the upper directory '..' to see.
So, the snippet is O.K. and your problem must be somewhere else.
First, I'm surprised to see a while - loop without brackets.
'd imagine that a port of $argument has to be right quoted.
Can you show us the content of $argument.
But could it be only a typo, as you surely meant:
/home/usr/usrname
^
with a leading slash.
Cheerio,
Janek
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]