"be consistent" | |
PerlMonks |
Re: Reading all files in a directory with one filehandleby tinita (Parson) |
on Apr 03, 2013 at 09:40 UTC ( [id://1026808]=note: print w/replies, xml ) | Need Help?? |
The array @files only contains the filenames without the full path. Prepend the path of the directory to the filename. And please use some more modern code for open: open my $fh, "<", "/tmp/files/$file" or die $!; The code to ignore . and .. also looks strange to me. I usually do my @files = grep { not m/^\.\.?$/ } readdir $dh;
In Section
Seekers of Perl Wisdom
|
|