----- Original Message ----- 
From: "jim" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, February 02, 2001 10:46 PM
Subject: More efficient way to write?


> 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
> 

Change line 4 to - my @suffix = ('html', 'htm', 'doc'); 
then add - for (@suffix) {$hash1{"\U$_\E"} = 1 };
and change line 11 to - return unless $hash1{"\U$_\E"};


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

Reply via email to