in reply to using vec() and unpack()


Another way to do it is to use ord and printf*:
#!/usr/bin/perl -wl use strict; my $char = '~'; print ord $char; printf "%08b\n", ord $char; __END__ Prints: 126 01111110

* The "%b" format is only available with perl5.6 or later.

--
John.