P is for Practical | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Now I'm all flabbergasted. What's going on there? As it doesn't print the '0's, it seems the only thing that gives the right number of '1's is "Less than or equal to". Everything else seems to do something unexpected. What did I do wrong here? The first answers correctly note the precedence issues. Your script does not print '0's because the boolean operators (i.e., everything except for cmp) are returning '' for the boolean false value. To get around both issues, and learn about eval, try this instead:
Yes, I do the eval twice; normally I would avoid that, but here there is no side effect by design and the penalty is small. Update: Add missing { back in. (Thanks Athanasius!) In reply to Re: Newbie flabbergasted by string compare results
by rjt
|
|