Yes, pack can do that. Take a look at perlpacktut in the manpages or pack in perlfunc.
In reply to Re: Perl socket programming by peter in thread Perl socket programming by Anonymous Monk