Help for this page
print get_num('.'); ... (sort{$b<=>$a} map{/(\d+)/, $1}<$dir/foo_*.bar>)[0] + 1; }
sub get_num{ my $dir = shift; ... /(\d+)/ and $1>$c and $c=$1 while <$dir/foo_*.bar>; return $c+1; }