amarks has asked for the wisdom of the Perl Monks concerning the following question:
open(AT_LIST, ">>$at_file") ; # $at_file defined elsewhere foreach $bch (@branch_array) { AT_LIST = qx'AT, $bch' ; #One of many variations i've tried } close(AT_LIST);
As you can see from the above code I'm trying to run the windows command "AT" against several servers from within perl and write the output via filehandle to a text file.
I've tried SYSTEM in many variations and can only collect the return code. After rereading (bits of) programming perl I realised I needed qx() but after trying many variations in the syntax can't for the life of me get it to run.
Is there a problem with using a filehandle ? is it plain impossible to do what I want ?
Or, as seems very likely, am I missing something very obvious here ?
Could some enlightened being point me in the right direction ?
Many thanks
Alan
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Capturing output with qx()
by davorg (Chancellor) on Oct 08, 2001 at 19:24 UTC | |
|
Re: Capturing output with qx()
by Fletch (Bishop) on Oct 08, 2001 at 19:37 UTC | |
|
Re: Capturing output with qx()
by data64 (Chaplain) on Oct 13, 2001 at 18:19 UTC | |
by amarks (Initiate) on Oct 16, 2001 at 23:17 UTC |