in reply to Creating trailer on packets

How about this?
# ... $packet = sprintf("%-60s",$packet); $packet =~ s/\s/\0/sg; #<-- kludgey #...
I couldn't get sprintf to pad with a certain character and left-justify at the same time - maybe someone else can suggest something?