Maybe it's trying to encourage you to specify the return value explicitly, as in
orreturn undef;
return ();
Update: Here's a table of the differences:
| return undef; | return (); | return; | ||
|---|---|---|---|---|
| scalar | $sv = foo(); | undef | undef | undef |
| boolean | if (foo()) { } | false | false | false |
| string | '' . foo() | '' with warning | '' with warning | '' with warning |
| number | 0 + foo() | 0 with warning | 0 with warning | 0 with warning |
| list | my @a = foo(); | ( undef ) | ( ) | ( ) |
| boolean list assignment | if (my @a = foo())
if (my ($sv) = foo()) if (() = foo()) | true | false | false |
| scalar list assignment | my $sv = () = foo() | 1 | 0 | 0 |
Note: How list assignments are treated in scalar context is what allows
while (my ($key) = each(%hash))
to work even if there's a key named 0.
In reply to Re^2: Module Announcement: Perl-Critic-1.01
by ikegami
in thread Module Announcement: Perl-Critic-1.01
by jthalhammer
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |