use IO::Capture::Stderr; my $capture = IO::Capture::Stderr->new(); $capture->start(); # start captured # your stuff here... print STDERR "...\n"; # STDERR is captured print "...\n"; # STDOUT is not captured # at the end $capture->stop(); # stop capture my @err = $capture->read; if ($#err >= 0) { # any captured error? print "$_" for @err; # print stderr to screen ; # wait for input }