http://qs321.pair.com?node_id=829720


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.

Replies are listed 'Best First'.
Re^2: File ext number
by ikegami (Patriarch) on Mar 19, 2010 at 23:16 UTC

    If one does not, it will return an undef value.

    No, m// never returns undef. (It could, it just doesn't.)

    because it doesn't convert to zero.

    No, undef DOES convert to zero when used as a number.

    In fact, when undef is or would be converted to a string ("") or number (0) is when you get that and similar warnings.