in reply to Re^4: File handling basics
in thread File handling basics

Then replace the while loop with this code my @lines = <F>;

open (F, $file) or die "cannot open file"; my @lines = <F>; close F;

you can do the same with perl module File::Slurp

use File::Slurp; my @array = read_file($filename);

All is well. I learn by answering your questions...