Hi,

I need to search a binary file using a regex, and replace a 20-byte string with 
another 20-byte string (binary).  

The FAQ talks about  "perl -pi -e 's/foo/bar/g' myfile", but given that I'm 
dealing with binary, and that I want to do this from within a larger script, 
that is less than ideal.

I can't wrap my head around how to do it with slurp mode and "while (<$fh>) 
{...}".

The regex for the substitution is "(SASI {6}.{20})(.{20})(2009$schno)", and I 
want to replace it with "$1$mybinary$3", where $mybinary is a 20-byte binary 
string.

Could anybody point me in the right direction?

Thanks,
Chap
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/


Reply via email to