in reply to Re: Logic expression evaluation not working. What am I doing wrong?
in thread Logic expression evaluation not working. What am I doing wrong?
#from Anonymous Monk code > my %allowed = qw{ ( ( ) ) ! !! & && }; > my $finalExpr = map { $allowed{$_} || die "not allowed '$_'" } split + '', $expr;
The %allowed hash doesn't look right and it isn't, among other things because it forgets digits [0-9]. A solution along these lines might do something like using taint mode for the script and then:
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; }
Ron
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Logic expression evaluation not working. What am I doing wrong?
by AnomalousMonk (Archbishop) on Jan 04, 2016 at 20:02 UTC | |
by Anonymous Monk on Jan 04, 2016 at 20:42 UTC | |
by AnomalousMonk (Archbishop) on Jan 04, 2016 at 20:50 UTC | |
Re^3: Logic expression evaluation not working. What am I doing wrong?
by Anonymous Monk on Jan 04, 2016 at 18:41 UTC |
In Section
Seekers of Perl Wisdom