in reply to unpack() removing data
open FILE, "temp.bin" or die $!; binmode FILE; open OUTFILE2, ">", "outfile2.txt" or die $!; while (<FILE>) {
Reading a binary file using realine (aka. the <> operator) is wrong. Depending on your OS and the current setting of $/, weird things can happen when a binary value (integer; short, long,long; signed, unsigned) happens to contain a byte that looks like the delimiter.
You should use read or sysread or set $/ = undef and slurp, or set $/ = \nnn; and read fixed length chunks.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: unpack() removing data
by shnatko (Initiate) on Jan 10, 2013 at 22:55 UTC | |
by BrowserUk (Patriarch) on Jan 11, 2013 at 09:58 UTC | |
by quester (Vicar) on Jan 11, 2013 at 07:09 UTC | |
by shnatko (Initiate) on Jan 11, 2013 at 14:31 UTC |