in reply to processing files

use strict; my $filelist = "/foo/bar/file.txt" open(FILE, $filelist) or die "$!\n"; while(<FILE>) { chomp; open(FILE2, $_) or die "$!\n"; <do whatever> close; } close;

This is assuming one filename per line.

Replies are listed 'Best First'.
Re^2: processing files
by chb (Deacon) on Dec 07, 2004 at 07:36 UTC
    You should say close(FILE2) and close(FILE), because close does not look at $_ to see what should be closed, it closes the currently selected filehandle ($_ gets clobbered in your while-loop, anyway).