Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

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 browsing the Monastery: (8)
As of 2016-07-25 15:41 GMT
Find Nodes?
    Voting Booth?
    What is your favorite alternate name for a (specific) keyboard key?

    Results (224 votes). Check out past polls.