tprayush has asked for the wisdom of the Perl Monks concerning the following question:
$ cat sigtrap #!/usr/bin/perl $SIG{'INT'} = 'ABORT'; sub ABORT { print "\nStop the loop?? (y/n) : "; chop($ch=<STDIN>); if ($ch =~ /[yY]/) { exit(1); } else { redo; } } $no=0; while (1) { print "$no\n"; sleep 2; $no++ }
but how can i solve this ..i.e. continuing in the loop!! plz help!! thanx.$ ./sigtrap 0 1 2 3 ^C Stop the loop?? (y/n) : n Can't "redo" outside a loop block at ./sigtrap line 16, <STDIN> line 1 +.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: how to continue in the loop after traping signal
by zwon (Abbot) on May 02, 2010 at 22:41 UTC | |
|
Re: how to continue in the loop after traping signal
by bart (Canon) on May 02, 2010 at 22:43 UTC | |
|
Re: how to continue in the loop after traping signal
by samarzone (Pilgrim) on May 03, 2010 at 06:30 UTC |