in reply to Creating a binary file problem

Also, are you sure that you want this:
$len = length $gBuf{$bName}[0];
and not:
$len = @{$gBuf{$bName}};
?

Replies are listed 'Best First'.
Re^2: Creating a binary file problem
by ikegami (Patriarch) on Apr 05, 2012 at 20:52 UTC
    Indeed, and the indexes start at zero, not one. Actually, one could simply use a foreach loop.
    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)); }