# ungetestet my $max = 'foo' . max( map { /^foo(\d+)$/ ? $1 : () } keys %test );