[Omaha.pm] RE: Wow! I used map!

Jay Hannah jhannah at omnihotels.com
Wed Apr 6 14:00:47 PDT 2005


 
> my ($dir, @files);
> foreach $dir ($in_dir, $waiting_in_dir) {
>    opendir(DIR, $dir);
>    push @files, map { $_ = "$dir/$_" } readdir DIR;
>    closedir DIR;
> }

Then, of course, I need a custom sort sub so the path is ignored when sorting... -grin-

j


print join "\n", sort by_filename_date @files;

sub by_filename_date {
   my $j = uc($a);
   my $k = uc($b);
   $j =~ s/.*\///;
   $k =~ s/.*\///;
   $j cmp $k;
}




More information about the Omaha-pm mailing list