in reply to Reading content of many files in an array
How about this?
Clearing the record separator ($/) makes it take the entire contents of the file on read, this also preserves the new line chars, though, too.Offending code removed
HTH
Update:tilly's right on the mark: an answer using proper code takes precidence over minimally changing the presented code to work. So, this is my final answer, ie., how I would've done this from scratch:
my @member_list = qw( fileone filetwo filethree ) ; my @all_members = () ; for my $file ( @member_list ) { open IN, "$file.dat" or die "Can't open '$file': $!" ; local $/ ; push @all_members, <IN> ; close IN ; }
-Ducky
|
|---|