We don't bite newbies here... much PerlMonks

### Re: Bits & pieces

by jdalbec (Deacon)
 on Jul 16, 2005 at 03:18 UTC Need Help??

in reply to Bits & pieces

Replies are listed 'Best First'.
Re^2: Bits & pieces
by bobf (Monsignor) on Jul 18, 2005 at 07:58 UTC

Good job! Included below is an explanation of this JAPH which is a bit (ba-dum-bum) more verbose. Your analysis hit on the big points, but I wanted to fill in some of the more subtle reasoning.

the two characters are negated in alternate calls to the closure.
For that to be true, \$_{64} would have to be '010101010101010101010101'. But I see that the output of the closure is more predictable than I had thought at first. The final result depends only on the last three (to some extent, six) characters of the string (in fact it's the same as the last character of the string).
```\$O = 19, \$C = ~\$C& 0x4D; # bits 7+ all 0
\$O = 20, \$C = ~\$C| 0x20; # bits 7+ all 1
\$O = 21, \$C = ~\$C^ 0x70; # bits 7+ all 0 bits 6543210
\$O = 22, \$C =  \$C&~0x6F; # bits 7+ all 0      00?0000
\$O = 23, \$C = ~\$C| 0x73; # bits 7+ all 1      1111111
\$O = 24, \$C =  \$C^~0x74; # bits 7+ all 0      1110100
I see also that I was bitten by contexts again. The correct list of values for &\$s in scalar context is
```# 0 4294967295 105  8 4294967263  73  8 4294967263  77  4 4294967291
+53
# 0 4294967295 116 20 4294967263 112 13 4294967282 125 16 4294967295 1
+16

Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://475403]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2024-06-15 15:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?

No recent polls found

Notices?
 • erzuuli ‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.