The eq operator works on strings, and thus turns its two operands into strings before doing anything else. This is called "string context" and also happen when you print something:
0x11 is a number (17), not a string, so perl turns it into a string the way it usually does. You can try this: print 0x11; and you'll see that ($status eq 0x11) is actually ($status eq "17"). If you want to do a character comparison, you can do: $status eq chr(17)# here EXPR is in string context print EXPR;
In reply to Re: vexed by the hex!
by Eily
in thread vexed by the hex!
by holandes777
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |