find( {wanted=> \&wanted, preprocess => \&preprocess }, #Added this line thats it '.'); #Added this function as well sub preprocess { my %afiletimes; foreach(@_) { $afiletimes{$_} = -M $_ if -f ; } @_ = sort { $afiletimes{$b} <=> $afiletimes{$a} } keys %afiletimes; }