in reply to Re: using qx{}
in thread using qx{}
While you are correct in your statements about interpolation, your second system call will not store anything in $foo[0] besides 0 (or, possibly, 256). The difference between system and qx is quite important - the former returns the return value of the code's execution, and the latter will return the output from the code's execution.
Should you desire to keep the string passed to a qx from interpolating, use single quotes as the delimiter, like so:
@foo = qx'echo $HOME';Which should store "/home/cheesy\n" or something like that in $foo[0]. I hope that helps...
Update: Changed emphasis in a few places.
Update #2: The node I replied to has had its content altered in a way that makes this node make no sense... the original second system call was as follows:
@foo = system('echo $username[0]');I hope that clears up any confusion.
His Royal Cheeziness
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: using qx{}
by Rhandom (Curate) on Sep 05, 2001 at 01:38 UTC |