Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Re: having trouble unmasking a binary string

by Cristoforo (Deacon)
on Mar 28, 2013 at 03:09 UTC ( #1025838=note: print w/replies, xml ) Need Help??

in reply to having trouble unmasking a binary string

At this point
$binPet =~ s/^0+(?=\d)//;
$binPet contains the string '10' and then when you print out that string in
printf "%s%bn%s", "\n", $binPet, "\n";, it gives the binary representation of ten, (1010), not a binary '2', (0b10).

And I don't know the purpose of 'n' in the printf format string, "%s%bn%s".

Beyond that, I'm not sure of what to tell you - the purpose of the code.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1025838]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2016-10-26 22:06 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (350 votes). Check out past polls.