A naked return; at the end is IMHO the best workaround.¹
Of course one could write a module which parses all functions during one of the BEGIN-phases and wraps a naked return if there is no return as final statement, but this is IMHO far too vulnerable for production. ( update and wouldn't work for dynamically defined functions)
Cheers Rolf
( addicted to the Perl Programming Language)
¹) It returns an empty list in list context which produces an undef in scalar context.
In reply to Re: Hope a subroutine will return undef by default
by LanX
in thread Hope a subroutine will return undef by default
by qj1020
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |