http://www.perlmonks.org?node_id=1179507


in reply to vexed by the hex!

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:

# here EXPR is in string context print EXPR;
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)