use Term::ReadLine; my $term = Term::ReadLine->new('Simple Perl calc'); my $prompt = "Enter code: "; my $OUT = $term->OUT || \*STDOUT; while ( defined ($_ = $term->readline($prompt)) ) { my $res = eval("package allowed_subs; $_"); warn $@ if $@; print $OUT $res, "\n" unless $@; $term->addhistory($_) if /\S/; } package allowed_subs; sub ab { `xmessage "@_"` # Pop-Up input (linux only) }