http://qs321.pair.com?node_id=1063529


in reply to IPC::System::Simple: Why isn't my exception caught?

There is no error because the exit value for "cat $file | wc -l" is 0 (zero).

Change the command to "wc -l file", as you say, and you get the error.

use IPC::System::Simple qw( capture $EXITVAL); use strict; use warnings; use Try::Tiny; my $file = 'foo'; my $result; try { $result = capture("cat $file | wc -l"); } catch { print "Error: $_"; }; print "Exitval is $EXITVAL";