$ ./2.cw1.pl ... object created, back with caller word is 2.cw dir2 is perlmonks 2.cw1.html 2.cw2.html ... 2.cw9.html 2.cw10.html 2.cw11.html ... matching is 2.cw9.html matching is 2.cw10.html matching is 2.cw11.html old num is 11 Make rus captions(y/n)?: n ... Put file to server(y/n)?: y server dir is perlmonks ... return is 2.cw12.html #### sub highest_number { use 5.011; my ( $aref, $filetype, $word ) = @_; my $number; my @matching; my $ext = "." . $filetype; push( @matching, 0 ); #min returned value for my $file ( @{$aref} ) { #print "file is $file\n"; if ( $file =~ /^$word(\d+)$ext$/ ) { print "matching is $file\n"; push( @matching, $1 ); } } @matching = sort { $a <=> $b } @matching; my $winner = pop @matching; return $winner }