in reply to Isn't Perl5 ready for C<my sub>?
(With all the caveats of local and symboltable hacking, of course.)sub invert { my ($n, $p)=@_; # Trusting $p to be a prime... local *expp = sub { my ($n, $m)=@_; return 1 unless $m; ($m%2 ? $n : 1) * expp($n, $m >> 1)**2 % $p; }; expp($n, $p-2); }
-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Isn't Perl5 ready for C<my sub>?
by friedo (Prior) on Sep 07, 2005 at 16:48 UTC | |
|
Re^2: Isn't Perl5 ready for C<my sub>?
by blazar (Canon) on Sep 07, 2005 at 15:26 UTC |