in reply to using vec() and unpack()

Apparently what you want instead of this:
my @charBits = split(//, unpack("b8", $temp));
is rather something like this:
my @charBits = split(//, unpack("b8", $char));
But apart from that, you should test some value other than the tilde character, and make sure you figure out whether you want to use "b8" or "B8" as the formatting string for the unpack call.

As for doing 'unpack("b8", $temp)', it's hard for me to figure out what that actually does. Note that you get more output if you use "b*" there -- but that didn't help me at all, I still don't know what it's doing.

Replies are listed 'Best First'.
Re: Re: using vec() and unpack()
by Gerard (Pilgrim) on Aug 16, 2003 at 04:52 UTC
    Thanks, after reading antirice's reply above, I ended up with something very similar to your suggestion:
     @charBits = split(//, unpack("b8", @chars[$currentChar])); which does the trick quite nicely.
    Thanks again
    Gerard