> *** malloc: vm_allocate(size=8421376) failed (error
> code=3)
> *** malloc[5576]: error: Can't allocate region
> Out of memory!
> 
> The strange thing is that I'm not slurping up the
> whole file,

Oh but you are...

> I'm reading it line by line.  But Perl
> seems to be slurping the whole thing into memory
> before even processing the first line. But even so,

> foreach my $line (<FILE1>) {

This reads in the whole file first because the (...) of
for each enforces list context, and the <FH> in list context
does read in the whole handle.  You meant

while (my $line = <FILE1>) {
    my $line = $_;

or something similar.

Reply via email to