open(INP, "<$file_list") or die("Error reading file"); while (my $data_file = ) { chomp($data_file); # then call a subroutine which opens the $data_file # and performs some analysis on it }