At 10:38 +0100 2000.12.07, Giorgio Valoti wrote: >Hi all! >I'm banging my head against the wall... I have a list of filenames and >the relative days-since-last-modification value... >$dir ="Macintosh HD:Desktop Folder:Download"; >opendir (DIR, $dir) > or die "Non posso accedere a DIR: $!"; > >while (defined(my $nomeFile = readdir (DIR))) { > $nomeFile = $dir.":".$nomeFile; > $gg = int (-M $nomeFile); >} > >Now, I want to print out a sorted list by days-since-last-modification >of the filenames. How can I do this? 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"; } -- Chris Nandor pudge@pobox.com http://pudge.net/ Open Source Development Network pudge@osdn.com http://osdn.com/ # ===== Want to unsubscribe from this list? # ===== Send mail with body "unsubscribe" to macperl-request@macperl.org