in reply to Re: Module Announcement: Perl-Critic-1.01
in thread Module Announcement: Perl-Critic-1.01

Returning an explicit undef can be a problem if the sub gets called in list context. Because then the return value will be a one element list containing an undef, which would evaluate to "true" and that is in most cases not what you want. A naked return; dwims in scalar and list contexts.


holli, /regexed monk/

Replies are listed 'Best First'.
Re^3: Module Announcement: Perl-Critic-1.01
by Spooner (Acolyte) on Jan 30, 2007 at 02:35 UTC
    the return value will be a one element list containing an undef, which would evaluate to "true" and that is in most cases not what you want.
    Boolean list context? I'm baffled as to what case you are concerned about. As to "most cases", I quibble. Some, but not most.