in reply to Re: subdirectory question
in thread subdirectory question
Why are you using a hash to store what seems like a simple list of file names? I would use a simple @array.
use the perl grep function to search an array.
Don't you see the contradiction in these two sentences? I'd use a hash, but with the names read into the keys, not the values. That way, you can easily check whether a filename is in the hash. For example,
searches for binaries with the names given on ARGV.while(<>) { /(.*)/; $names{$1} = 1; } use File::Find (); File::Find::find sub { $names{$_} and -x and print $File::Find::name, "\n"; }, grep -e, split ":", $ENV{"PATH"};
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: subdirectory question
by NetWallah (Canon) on Jan 04, 2005 at 01:44 UTC | |
by ambrus (Abbot) on Jan 04, 2005 at 10:32 UTC |