in reply to Re^2: Using FastCGI
in thread Using FastCGI
What error did it cause? I just tested the following code:
my @found = grep { -f && /\.pl/ } @array;
... and it did work.
You are probably not invoking the script from within the working directory. If you have proper permissions, you can 'chdir', or you could specify the full path like this:
my @files = grep { -f && /^parsed.*\.txt$/ } map { "$dir/$_" } readdir($dh);
A subtle change. From an efficiency standpoint, *slightly* worse, as map now acts on every item returned by readdir. But on the other hand, it works if your path is not your current directory. Besides, even if your directory has a thousand files in it, the map and grep aren't costing you much time. Again, this is where profiling comes in. :)
Look at the CPAN module Devel::Profile.
Dave
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Using FastCGI
by jonc (Beadle) on Jun 15, 2011 at 05:19 UTC | |
by davido (Cardinal) on Jun 15, 2011 at 05:30 UTC |