Just another Perl shrine | |
PerlMonks |
Re: end of line helpby aquarium (Curate) |
on Nov 18, 2010 at 00:44 UTC ( [id://872101]=note: print w/replies, xml ) | Need Help?? |
that's a pretty good effort for a perl beginner. i know you're further down the track as you indicated however, i do question what is read into the array from the linkfile and what is really written. that's because you have not set the infile and outfile line endings..which is dodgy anyway is you're processing a true binary file, which has no line endings. and along the same lines, binary data is usually not suitable to split on a tab character, as that can imply encoding..which there is none for binary file. in case of a "true/real" binary file, you'd binmode both input and output, set input and output line endings to nothing (just to be sure they don't get appended somewhere automatically), sysread data into buffer and unpack, and then repack for the write. and you have to make sure that each bit of text that is replaced is exactly same length in bytes as on input. a regex with a scalar variable substitution is liable to break string length consistency unless done carefully. but like i said, you seem to be further down the track, and only you know the true nature of the binary file involved. enjoy perl. the hardest line to type correctly is: stty erase ^H
In Section
Seekers of Perl Wisdom
|
|