################################################################### # This subroutine pads 'txt' on the right to length 'len'. ################################################################### sub mypack { my $len = shift; my $txt = shift; $len =~ s/^A//i; # Remove 'A' that system "pack" function uses. return sprintf("%s%s",$txt, ' 'x(($len-length($txt)))); }