in reply to Opening files in a loop

Does chomping @data_names help?

@data_names = <JOE>; chomp @data_names; # . . .
Your file names probably don't have newlines at the end.

Your loop could be written more perlishly as

for (@data_names) { # $_ contains each name in turn }

There is nothing wrong with re-using a file handle as you do. It's customary nowadays to use a lexical handle and 3-arg open,     open my $fh, '<', $_ or die $!;

After Compline,
Zaxo

Replies are listed 'Best First'.
Re^2: Opening files in a loop
by tilly (Archbishop) on Jun 04, 2005 at 03:15 UTC