in reply to Memory efficiency, anonymous vs named's vs local subroutines

But why do you want nested subs in the first place? You're not making closures, right? One common way to get "private" helper subs in your module is:

sub something_useful { my $x = _helper(shift); return $x; } sub _helper { ... }

One major advantage is in testing: the helper subs can be called directly.

Replies are listed 'Best First'.
Re^2: Memory efficiency, anonymous vs named's vs local subroutines
by thanos1983 (Parson) on Jul 18, 2015 at 18:56 UTC

    Hello Anonymous,

    Thank you for your time and effort, reading and replying to my question.

    No I am not planning to use nested subs. I guess a solution like the one you proposed is the most efficient and correct to follow.

    Seeking for Perl wisdom...on the process of learning...not there...yet!