in reply to File ext number

You are not accounting for the files with no '.' character. Your regex using '+' requires that at least one period characters will appear before the end of text. If one does not, it will return an undef value.

One or more files ends in a '.', which returns an undef match.

undef is your uninitialized value because it doesn't convert to zero.