Yes, you use backticks ` without system to capture the output.
my @output = `cat filename`;
now @output contains all the lines of filename.
-----Original Message-----
From: Edouard Beaugard
To: [EMAIL PROTECTED]
Sent: 8/31/2001 9:28 AM
Subject: need help with system or exec
---------------------- Forwarded by Edouard Beaugard/Bsg/MetLife/US on
08/31/2001 10:35 AM ---------------------------
Edouard Beaugard
08/31/2001 10:01 AM
To: [EMAIL PROTECTED]
cc:
Subject: need help with system or exec
---------------------- Forwarded by Edouard Beaugard/Bsg/MetLife/US on
08/31/2001 10:08 AM ---------------------------
Edouard Beaugard
08/31/2001 09:56 AM
To: [EMAIL PROTECTED]
cc:
Subject: need help with system or exec
I have a script that runs nbtstat for a group of workstations. I'd like
to
be able to capture the output within the script into an array. Here's
what
I'm doing:
1.
@info = system `nbtstat -a machinename`;
-or-
2.
@info = system 'nbtstat -a machinename';
-or-
3.
@info = system('dir c:\\perl')
None of these work. With 1 I get the error
"A domain controler for Connection: could not be found."
With 2, I get the output but it goes to STDOUT and not the array.
3 is the same as 2, the output goes to STDOUT and not the array.
Any suggestions at all?
Thanks,
Ed Beaugard
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]