Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: termination of system command

by svenXY (Deacon)
on Feb 11, 2008 at 15:21 UTC ( [id://667398]=note: print w/replies, xml ) Need Help??


in reply to termination of system command

Hi,
you can also open it with '-|' (pipe from vmstat) and then use a while-loop as shown below:
#!/usr/bin/perl use strict; use warnings; open(STAT, '-|', 'vmstat 2') or die "Could not open pipe: $!"; my $count; # not necessary, just for demonstration while (<STAT>){ last if $count++ > 5; # we don't want more than 5 lines of out +put print $_, "\n"; } print "...done\n";

Regards,
svenXY

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://667398]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (2)
As of 2026-05-08 15:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.