in reply to Trouble opening files from a directory: "no such file".
There is another way to do this, I find it a lot easier to use glob() to get a list of files.
@files then contains all the files that match the filename expansion. BTW glob doesn't use regex but expands filenames like the unix shell.my @files = glob("$dir/*.txt");
It's a lot less typing anyway ;)
Also, you could use File::Slurp to read the files.
use File::Slurp; my $text = read_file($filename); # or my @lines = read_file($filename);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Trouble opening files from a directory: "no such file".
by Corion (Patriarch) on Aug 10, 2011 at 12:22 UTC |