in reply to Re^2: how to stop command
in thread how to stop command

Not quite. I mean more like this:

my $timeout = 5; my @file_list; eval { local $SIG{ALRM} = sub { die "alarm\n" }; alarm $timeout; @file_list = `ls user/test/`; alarm 0; }; if ($@) { die $@ unless $@ eq "alarm\n"; # propagate unexpected errors # timed out print "Have incomplete file list\n"; } else { print "Have complete file list\n"; } foreach my $file (@file_list) { print "$file\n"; }