Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

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 all is quiet...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2017-06-26 19:46 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (589 votes). Check out past polls.