Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Easy way to capture STDOUT and STDERR without IPC

by eff_i_g (Curate)
on Apr 20, 2011 at 17:24 UTC ( #900389=note: print w/ replies, xml ) Need Help??


in reply to Easy way to capture STDOUT and STDERR without IPC

If you don't need the entire string and you'd rather loop you can do something like this:

open my $CMD, '-|', 'ls 2>&1' or die $!; while (<$CMD>) { print if /\.xml/; } close $CMD or die $! ? 'Pipe failed' : 'Program error: ' . ($? >> 8) ;


Comment on Re: Easy way to capture STDOUT and STDERR without IPC
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (8)
As of 2014-11-22 21:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (125 votes), past polls