use strict; use warnings; use IO::Pipe; my $cmd = "tasklist"; my $pipe = IO::Pipe->new(); $pipe->reader($cmd); while (my $line = $pipe->getline()) { print $line; last if $line =~ /^smss/; } $pipe->close(); C:\>R:\io_pipe_test.pl Image Name PID Session Name Session# Mem + Usage ========================= ======== ================ =========== ====== +====== System Idle Process 0 Services 0 + 24 K System 4 Services 0 + 300 K smss.exe 284 Services 0 1 +.140 K Terminating on signal SIGINT(2) C:\>
In reply to IO::Pipe hangs by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |