in reply to Re: Reading from file, not to memory
in thread Reading from file, not to memory

Your code still loads all the file first! The code (<FH>) generate first all the array that will be readed by foreach!

Take a look in this 2 test scripts. They show the file buffer position when you print each line:

my $file = $0 ; open(FH, $file) ; foreach my $line (<FH>){ my $tel = tell(FH) ; print "$tel>> $line" ; } close FH;
OK way:
my $file = $0 ; open(FH, $file) ; while ( my $line = <FH> ) { my $tel = tell(FH) ; print "$tel>> $line" ; } close FH;
You can see that in the 1st way the buffer was always in the end, because it already have loaded all the file!

Graciliano M. P.
"The creativity is the expression of the liberty".