On Tue, Nov 13, 2001 at 04:25:26PM -0500, Greg London wrote:
> Is there a binary equivalent to the "hex" function?
> 
> I have a string that represents a binary value,
> and I want to convert it to an integer value
> and do some math with it.
> 
> if it were a hex string, I'd "hex" it.
> what if its a binary string?

In perl5.6.0 or later, you can use oct() to convert a binary string that
starts with 0b, e.g. oct('0b11') == 3.

Ronald

Reply via email to