Perl Monk, Perl Meditation | |
PerlMonks |
Re: Dynamically Create a fileby starX (Chaplain) |
on Aug 01, 2008 at 05:18 UTC ( [id://701594]=note: print w/replies, xml ) | Need Help?? |
I see a couple places you're going wrong. First and foremost, system() returns the exit status of the command, not the commands output. If you want the output of "lin --help", you should run it as qx/$command/. Of course, qx// doesn't pay attention to STDERR, so if you're interested in capturing that, you should re-write the command as $command = "lin --help 2> $test";
2> is the shells way of redirecting STDERR to someplace else. Try this on for size... Note the use strict; and use warnings; directives. Those are your friend. EDIT: I should probably mention that I used qx// rather than system() because the former will return a program's output, and the latter only returns the return status.
--starX
In Section
Seekers of Perl Wisdom
|
|