!/usr/bin/perl -w use strict; use diagnostics; my $file = 'test.dat'; open(FILE, ">:raw", "$file") or die "Could not open $file for writing: $!\n"; binmode(FILE, ":raw"); my $tmp = 9; my $output = pack( 'C', $tmp ); print FILE $output; close FILE; print "...Created $file\n";