use File::File; find( { wanted=>\&Wanted , preprocess=>\&PreProcess , } $dir ); sub PreProcess { return sort { $a cmp $b } @_; } sub Wanted { if ( $_ =~ /\d+\.\d+/ ) { open ( FILE , $_ ) or die "Screaming $!"; my @lines = ; doStuffwith(@lines); } else { return } }