# The sender packs it my $p = pack 'b4' , $str ; # And the receiver unpacks it like this: print unpack 'b4', $p;