Being paranoid about really big files, I'd probably do:
But setting $/ to be a reference to a block size is a recently added feature so be aware that your version of Perl may not support it yet. In which case you can change <INPUT> to: read(INPUT,$_,4096) - tye (but my friends call me "Tye"){ local $/= \4096; binmode(INPUT); binmode(OUTPUT); while( <INPUT> ) { if( s/^.*?(\x0d\x0a)/$1/s ) { print OUTPUT $_; last; } } print OUTPUT $_ while <INPUT>; }
In reply to (tye)Re: Manipulating Binary files
by tye
in thread Manipulating Binary files
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |