[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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



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