- or download this
sub recurse {
my $level = shift;
print "recurse [$level]\n";
recurse($level - 1) if $level > 0;
}
- or download this
#!/usr/bin/perl -w
...
*oldsub = \&newsub;
$oldsub_ref->(2);
- or download this
oldsub [2]
oldsub [1]
...
Subroutine main::oldsub redefined at ./typeglob_clobber.pl line 22.
oldsub [2]
newsub [1]
- or download this
my $coderef = do {
my $selfref;
...
# use $selfref here for recursion
};
};
- or download this
{
my $selfref;
...
}
$selfref = \&named;
}