Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re: end of line help

by aquarium (Curate)
on Nov 18, 2010 at 00:44 UTC ( #872101=note: print w/replies, xml ) Need Help??

in reply to end of line 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

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://872101]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2020-05-27 07:30 GMT
Find Nodes?
    Voting Booth?
    If programming languages were movie genres, Perl would be:

    Results (153 votes). Check out past polls.