in reply to Re^2: I've muddled my bit and byte formats.
in thread I've muddled my bit and byte formats.

Note that

"\x01" & 1

equals 0, not 1. See perldoc perlop "Bitwise String Operators" for why.

Replies are listed 'Best First'.
Re^4: I've muddled my bit and byte formats.
by AnomalousMonk (Archbishop) on Oct 10, 2018 at 04:41 UTC

    murrayn:   ikegami beat me to it, but some other examples:

    c:\@Work\Perl\monks>perl -wMstrict -le "print qq{\x01} & 1; print qq{\cA} & 1; print qq{\x31} & 1; print '1' & 1; " Argument "^A" isn't numeric in bitwise and (&) at -e line 1. 0 Argument "^A" isn't numeric in bitwise and (&) at -e line 1. 0 1 1


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

Re^4: I've muddled my bit and byte formats.
by ikegami (Patriarch) on Oct 10, 2018 at 04:34 UTC

    But "1" & 1 would.