Think about Loose Coupling | |
PerlMonks |
Re: Re: using qx{}by CheeseLord (Deacon) |
on Sep 04, 2001 at 05:07 UTC ( [id://109974]=note: print w/replies, xml ) | Need Help?? |
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
In Section
Seekers of Perl Wisdom
|
|