Hello uncoolbob, and welcome to the Monastery!
How about using the Conditional Operator?
sub my_find_or_create { ... return defined $existing_result ? $existing_result : $new_result; }
Update: Or, better, just use Logical Defined Or:
return $existing_result // $new_result;
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
In reply to Re: return if defined
by Athanasius
in thread return if defined
by uncoolbob
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |