open TARGET_FILE, '>', 'foo' or die; binmode TARGET_FILE; my @list = 10; my $outputstring = pack("v*", @list); print TARGET_FILE $outputstring;