in reply to Re: Converting Binary to hex
in thread Converting Binary to hex

actually $binaddr is read from a hash. so the value is something like initialvalue = '0100010' which i read into $binaddr. So i am appending 0b while passing it to hex function. Looks like the format of the data extracted from the hash cannot be directly sent to hex function. Any idea?

Replies are listed 'Best First'.
Re^3: Converting Binary to hex
by Laurent_R (Canon) on Sep 30, 2016 at 06:20 UTC
    Hmm, I can't test right now, but the 0B prefix will work, I think, only for an initial numerical literal assignment. Once the value is in memory, you can no longer do it his way and you probably need to make an explicit conversion from binary string to whatever you need.