use strict; my $char = "~"; my $temp = vec($char, 0, 8); my @charBits = split(//, unpack("b8", $temp)); print $temp . "\n"; foreach (@charBits){ print $_; } #### 126 01111110 #### 126 10001100