#!/usr/bin/perl $SIG{ALRM} = sub { warn "waited too long, exiting. This is what I have:\n"; report(); exit; }; alarm(2); # time out after two seconds my $Pipe= ""; while (){ $Pipe .= $_; } report(); sub report { print "This was read from the pipe:\n"; print "<$Pipe>\n\n"; print "This was the read from the parameters:\n"; print "<@ARGV>\n"; }