in reply to Re: Module Announcement: Perl-Critic-1.01
in thread Module Announcement: Perl-Critic-1.01
I'd like to know when being explicit has ever been a problem.
It's a problem when return happens in array context -- you get a literal undef in the array. Contrived example:
use Data::Dump::Streamer; sub filter_true { if ( my $v = shift ) { return $v; } else { return undef; } } my @values = (1, 0, 0); my @true_values = map { filter_true($_) } @values; Dump \@true_values
Gives:
$ARRAY1 = [ 1, ( undef ) x 2 ];
-xdg
Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.
|
|---|