Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Re: search and replace (in-place) strings in binaryby choroba (Cardinal) |
on Jul 16, 2020 at 16:37 UTC ( [id://11119412]=note: print w/replies, xml ) | Need Help?? |
Might be. What's the actual string you want to replace? If it contains some special characters, they might need escaping. Also, what's the format of the files? Some binary formats might contain CRC checks which would be invalidated by changing some bytes. Also, if the binary format is fixed length or records the lengths of dynamic parts, you might need to pad the inserted string or update the recorded length.
map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
In Section
Seekers of Perl Wisdom
|
|