Note that the idiom of slurping an entire file into an array is a bad habit to get into. It's easy to do, but one day you will slurp a really big file by accident, exhaust all your RAM, start to swap, and bring your system to its knees.
A much better way to go about reading files is as follows:
open FILE, $filename or die "$0: cannot open $filename for input: $!\n
+";
# two notes
# 1. Put as much information as possible in the die string
# as you can lay your hands on.
# 2. That's \n, not /n, but I guess you realised that already...
while( <FILE> ) {
# possibly...
chomp;
# otherwise do what you want with $_
}
close FILE;
Creating scripts with small memory footprints is a good idea. Otherwise the other people using the system will start to equate Perl with prolifligate memory consumption, and we don't want Perl to get a bad name, right?
--g r i n d e r
|