in reply to Re^2: Logic expression evaluation not working. What am I doing wrong?
in thread Logic expression evaluation not working. What am I doing wrong?

The %allowed hash doesn't look right ...

I would be more concerned about the map statement:

c:\@Work\Perl>perl -wMstrict -le "my $expr = '(!(C)&T)&!Q'; my %allowed = qw{ ( ( ) ) ! !! & && C 1 T 1 Q 1 }; my $finalExpr = map { $allowed{$_} || die qq{not allowed '$_'} } spli +t '', $expr; print qq{'$finalExpr'}; " '11'


Give a man a fish:  <%-{-{-{-<

Replies are listed 'Best First'.
Re^4: Logic expression evaluation not working. What am I doing wrong?
by Anonymous Monk on Jan 04, 2016 at 20:42 UTC

    I would be more concerned about the map statement:

    :D I was hoping the OP would be concerned when trying, so he can get a link to Basic debugging checklist

    Then add the missing  join '',

      The map also fails if any of  C T Q is 0. This is easily fixed, but as you say, it's always nice to try stuff.


      Give a man a fish:  <%-{-{-{-<