It looks like you got you answer, but here are a couple of other ideas.

Instead of using /i in your regex - you can uc() or lc() the string first -
I think this may be more efficient.

Also,  ['html', 'htm', 'doc'] can be written somehting like

/\.htm[l]|\.doc/ (not tested- I think it is the correct format)



                                                                                       
                                          
                    "jim" <[EMAIL PROTECTED]>                                      
                                          
                    Sent by:                                     To:     
<[EMAIL PROTECTED]>            
                    [EMAIL PROTECTED]        cc:                   
                                          
                    eState.com                                   Subject:     More 
efficient way to write?                       
                                                                                       
                                          
                                                                                       
                                          
                    02/02/01 10:46 PM                                                  
                                          
                                                                                       
                                          
                                                                                       
                                          


hi perl friends,

is there a more efficient/elegant way to write line no. 11 below?

thanks!


#!perl.exe -w

use File::Find; #line 1
use strict; #line 2
my %dir; #line3
my $suffix = ['html', 'htm', 'doc']; #line 4
my $path = 'c:/hdb'; #line 5
find(\&wanted, $path); #line 6
 foreach (keys %dir) { #line 7
 print "$_ -> $dir{$_} $$suffix[0] files\n" #line 8
}#line 9
sub wanted { #line 10
return unless /\.$$suffix[0]|\.$$suffix[1]|\.$$suffix[2]|/i; #line 11
$dir{"$File::Find::dir"}++; #line 12
1; #line 13
} #line 14

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users




_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users

Reply via email to