- or download this
$ perl -w
sub nothing { return; }
...
__END__
foo has 0 elements after pushing nothing.
foo has 1 element after pushing something.
- or download this
sub foo {
return !! shift->{some_obj}->some_method;
}
- or download this
sub foo {
return ( shift->{some_obj}->some_method ) ? 1 : 0;
}
- or download this
sub foo {
return ( shift->{some_obj}->some_method ) ? 1 : ();
}
- or download this
sub foo {
return shift->{some_obj}->some_method || ();
}