in reply to How can I process large files with while(<>)?

Yup. Also you can do this on the command line using things like perl -nle (make an input loop) or perl -pi -e ("in-place" editting) as described in the perlrun manpage.

Since my paranoia turns on when I use -pi I often turn off paranoia (a biological process) and do something like
cat bigfile|perl -nle 's/escaped_old_ip/new_ip/g; print;' > newbigfile

You can also process files using the tie command, there are many modules which use it (Tie::). Good luck!

Replies are listed 'Best First'.
Re^2: How can I process large files with while(<>)?
by Aristotle (Chancellor) on Nov 18, 2002 at 00:01 UTC
    For one, that is a useless use of cat, for another, why use -n when you just want to print your lines anyway? That's what -p is for. You can also put -i to good use here to edit the file inplace, as well as supply a suffix for a backup copy to be kept. perl -i.bak -pe 's/escaped_old_ip/new_ip/g' bigfile Details are available in said manpage. :^)

    Makeshifts last the longest.