D
Dave
I have the following code snippet:
if ( !defined $base_ref->{pl} ) {
$base_ref->{pl} = 1;
}
following the 'Best practices' guidelines. Previously I had it as:
$base_ref->{pl} = 1 unless defined $base_ref->{pl};
which seems clearer to me...
In bash shell scripting there is the ${variable:=default} idiom. I
understand that Perl 6 will have something similar. Is there anything in
Perl 5 that is better than my three lines above and still within the Best
Practices guidelines?
Thanks
Dave
if ( !defined $base_ref->{pl} ) {
$base_ref->{pl} = 1;
}
following the 'Best practices' guidelines. Previously I had it as:
$base_ref->{pl} = 1 unless defined $base_ref->{pl};
which seems clearer to me...
In bash shell scripting there is the ${variable:=default} idiom. I
understand that Perl 6 will have something similar. Is there anything in
Perl 5 that is better than my three lines above and still within the Best
Practices guidelines?
Thanks
Dave