|Pathologically Eclectic Rubbish Lister|
Re: Hash (not) returned by subroutineby tobyink (Canon)
|on Jan 27, 2020 at 12:06 UTC||Need Help??|
Further to soonix's answer, if you wish to not return anything from a function, use:
Usually the former is preferred.
For object-oriented modules, if you don't have anything useful to return for a method, return $self is a good idea because it allows method calls to be easily chained, like:
A final note. Doing this:
Is actually very slightly slower than:
So if you have a small function that gets called a lot and you want to optimize, removing return and just allowing the last value evaluated to fall through as the return value may give you a slight boost.