in reply to Multiple files opened

Why do you need regex to read lines? my $data_file = m/(\w+)/; doesn't make sense to me

Here's how you write it :

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

Replies are listed 'Best First'.
Re^2: Multiple files opened
by Anonymous Monk on Sep 24, 2010 at 20:53 UTC
    To expand on this:

    my $data_file = m/(\w+)/; assigns a true or false value to the variable indicating whether the regular expression matched. To save the captured value, assign the return value of m// from list context, not scalar context.

    But if the desired result is to remove the newline, use chomp.