crabbdean has asked for the wisdom of the Perl Monks concerning the following question:
$found = 0; $hash{1} = '*.doc'; $hash{2} = '*.xls'; $hash{3} = '*.ppt'; map { $found = 1 if $file =~ /$_/; } values(%hash);
Any other ideas? Speed is the key here. Thanks.$found = 0; $hash{1} = '*.doc'; $hash{2} = '*.xls'; $hash{3} = '*.ppt'; for (values(%hash)) { $string .= $_ . "|"; } $found = 1 if $file =~ /$string/;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Multiple regex against files with speed
by jeffa (Bishop) on Apr 28, 2004 at 13:11 UTC | |
by crabbdean (Pilgrim) on Apr 28, 2004 at 13:35 UTC | |
|
Re: Multiple regex against files with speed
by eserte (Deacon) on Apr 28, 2004 at 14:15 UTC | |
|
Re: Multiple regex against files with speed
by pelagic (Priest) on Apr 28, 2004 at 14:13 UTC | |
|
Re: Multiple regex against files with speed
by Roy Johnson (Monsignor) on Apr 28, 2004 at 14:34 UTC | |
|
Re: Multiple regex against files with speed
by Fletch (Bishop) on Apr 28, 2004 at 13:19 UTC |