in reply to How to process each byte in a binary file?
from pervar:my $file = 'myverylargefile.bin'; { local *INPUT; local $/ = \1; open INPUT, '<', $file or die $!; while(<INPUT>) { ## process here... } }
Setting $/ to a reference to an integer, scalar containing an integer, or scalar that's convertible to an integer will attempt to read records instead of lines, with the maximum record size being the referenced integer.
~Particle *accelerates*
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: How to process each byte in a binary file?
by John M. Dlugosz (Monsignor) on Aug 12, 2002 at 21:16 UTC |