Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: File ext number

by snopal (Pilgrim)
on Mar 19, 2010 at 23:06 UTC ( #829720=note: print w/replies, xml ) Need Help??


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 (Pope) 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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://829720]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2020-10-30 13:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (279 votes). Check out past polls.

    Notices?