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

Re: [MacPerl] Ordering two lists



Chris Nandor wrote:
> 
> At 10:38 +0100 2000.12.07, Giorgio Valoti wrote:
> >Hi all!
[....]
> 
> You could use a hash.
> 
> my %hash;
> for my $file (readdir DIR) {
>         $hash{$dir . ':' . $file} = int -M $file;
> }
> 
> for my $file (sort { $hash{$a} <=> $hash{$b} } keys %hash) {
>         print "$hash{$file} : $file\n";
> }

Yes, that's right... however I think there's a typo: with the code
fragment above we should have:

my $fileName =  $dir . ':' . $file;

and use this variable to get the last modification.
I was missing the obvious 
"sort { $hash{$a} <=> $hash{$b} }"

Many thanks to all who have replied. 
bye
--
Giorgio Valoti

MagneticMedia Network

# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org