Perl Code: sub perl_pack_print() { $ofn='pack.test.dat'; # Output file Name $xres=7360; # X Resolution $pxres=pack("S", $xres); # Xres Packed into USHORT open(O, ">$ofn"); binmode O; print(O "$pxres"); close O; print("Perl: Pack number $xres into uint16 and dump to file $ofn\n"); # Verify that Perl wrote the correct data to disk system("hex_dec_bin_dump.exe $ofn"); # See if Perl can print the '%hu' it just wrote to disk printf("Number $xres Packed into 'S': h %x, d %d, hu %hu, b %b, s %s\n", $pxres, $pxres, $pxres, $pxres, $pxres); }