-
Senior Member
PERL: system and grabbing STDOUT
Hi,
If I use the system command in perl
system('/usr/bin/perl', 'pc.somedomain.com');
it returns 0 if successful and prints the pings to STDOUT(commandline)
how can I get all the info that is printed to STDOUT(the commandline?)
thanx,
-
Advisor
Re:PERL: system and grabbing STDOUT
[quote author=Blaqb0x link=board=9;threadid=7006;start=0#65043 date=1052764046]
...
system('/usr/bin/perl', 'pc.somedomain.com');
...
[/quote]
Can't you just do this:
$info=system('usr/bin/perl', 'pc.somedomain.com');
-
Senior Member
Re:PERL: system and grabbing STDOUT
I wish.
No, the system function returns 0 if it is successful.
-
Advisor
Re:PERL: system and grabbing STDOUT
Can you pipe it to something else or append it to a file?
system('/usr/bin/perl', 'pc.domain.com') > $file;
Then just read the file into a variable, close and delete it?
-
Senior Member
Re:PERL: system and grabbing STDOUT
No that doesn't work but I figured out that this does.
$output = `ping somemachine`;
print $output;
>> this prints out the ping
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks