http://qs1969.pair.com?node_id=460489


in reply to Interactive scripting with debugger

While it's not as powerful as using the debugger itself, I use a small block based around eval to achieve mostly the same thing:
while (1) { print "$0> "; chomp(my $input = scalar <STDIN>); last if $input =~ m/^(q|quit)$/; my $res = eval $input; chomp(my $out = $@ ? $@ : $res); print "$out\n"; }