hi all....
plz tel me how can i solve this....here's the situation (this is just a sample!!)..
Code:
$ 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++
}
Code:
$ ./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.
by using 'trap' in bash...we can continue in loop....if we write 'trap' in the loop...
but how can i solve this in perl!! plz help!!
thanx.