open(my $fh, '>:raw', $fn) or die "Couldn't open file for writing: $!\n"; for my $hex ( @{ $gBuf{$bName} } ) { printf $fh pack('C', hex($hex)); }