in reply to Re: How to set timer in perl
in thread How to set timer in perl
Here is the code which i have tried.
#!/usr/bin/perl -w use strict; my $FH; local $SIG{ALRM} = sub { die "Timeout no data received\n"; }; open ($FH, '<', "file1") or die "cant open file to read file$!.\n"; alarm 5; while (<$FH>){ if ($_ =~ m/any string/i){ print "$_\n"; alarm 0; } } close ($FH);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: How to set timer in perl
by Anonymous Monk on Jun 14, 2013 at 07:18 UTC |