#!/usr/bin/perl use strict; use warnings; $|++; use vars qw($go); $SIG{'INT'} = 'stop_counting'; $go = 1; my $code = q|my $x = 0; while ($go) { print"$x\n"; $x++; }|; eval($code); print "done counting!\n"; print $@ if ($@); sub stop_counting { $go = 0; print "\n\nstopping eval...\n"; } exit;