#from Anonymous Monk code > my %allowed = qw{ ( ( ) ) ! !! & && }; > my $finalExpr = map { $allowed{$_} || die "not allowed '$_'" } split '', $expr; #### print "EXPR = ",$newExpr,"\n"; # don't know how to execute shell commands without [A-Za-z] letters $newExpr =~ /^([\d\s()&|!]+)$/; printf "%b\n", eval $1; }