c.f File::Slurp
use File::Slurp; my @lines = read_file( $filename );
Also see the article in that distribution on file slurping and efficiency. It sugggests reading the file in one shot and then splitting on newlines instead of reading line-by-line.
-xdg
Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.
In reply to Re: getfile( $filename )
by xdg
in thread getfile( $filename )
by harleypig
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |