Private subroutines
In Pascal (sorry!) you can declare a sub within another sub. In Perl you can't. But you can define & use private subrefs:
sub my_realy_complicated_thing { my $easy_thing = sub { ... }; my $easier_thing = sub { ... }; ... my $x = $easy_thing->( @lots_of_complicated_stuff ); #etc }
Footnote
As I was typing this, I ended a sentence with ";"
Am I doing too much Perl?
In reply to Re: why use a coderef?
by FunkyMonk
in thread why use a coderef?
by juanbro
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |