$rgb[16] = 7360; # Overwrite 3689 with 7360 $rgb[22] = 4912; # 2462 -> 4912 #### open(my $outfile, '>:raw', $hfn) or die "Couldn't open $hfn: $!\n"; # Overwrites existing file print $outfile pack("S*", @rgb); close($outfile) or die "Couldn't close $hfn: $!\n"; #### open(my $fh, '+<:raw', $hfn) or die "Couldn't open $hfn: $!\n"; seek($fh, 2*16, 0); # Double up 'cause 'seek' wants bytes not short ints print $fh pack('S', 7360); seek($fh, 2*22, 0); print $fh pack('S', 4912); close($fh) or die "Couldn't close $hfn: $!\n";