Whitchman has asked for the wisdom of the Perl Monks concerning the following question:
and i have an array that contains a bunch of paths:my $path = "C:/temp/stuff";
What is the best way to see if @directories contains $path? The way i'm trying to do it now is:open (PATH, "c:/logs/paths.txt"); my @directories = <PATH>; close (PATH);
foreach (@directories) { if ($path eq $_) { stuff } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: searching an array?
by Biker (Priest) on Mar 15, 2002 at 12:20 UTC | |
|
Re: searching an array?
by broquaint (Abbot) on Mar 15, 2002 at 12:22 UTC | |
|
Re: searching an array?
by rdfield (Priest) on Mar 15, 2002 at 12:11 UTC | |
|
Re: searching an array?
by Parham (Friar) on Mar 15, 2002 at 16:22 UTC | |
by Whitchman (Novice) on Mar 15, 2002 at 22:27 UTC |