Commits

Shlomi Fish  committed e9d81ff

Avoid memory leak.

  • Participants
  • Parent commits d224b51

Comments (0)

Files changed (1)

File project-euler/148/calc-num-Y-in-row-ORIG-2.pl

 use strict;
 use warnings;
 
+use 5.016;
+
 use integer;
 # use Math::BigInt lib => 'GMP', ':constant';
 
         $power *= $BASE;
     }
 
-    my $recurse;
-
-    $recurse = sub {
+    my $recurse = sub {
         my ($d_len) = @_;
 
         if ($d_len <= 0)
             my $big_Y_num = ($digits[$d_len]->{power}-1-$digits[$d_len-1]->{total_mod});
             my $big_Y_total = $big_Y_num * $digits[$d_len]->{d};
 
-            return $big_Y_total + ($digits[$d_len]->{d}+1) * $recurse->($d_len-1);
+            return $big_Y_total + ($digits[$d_len]->{d}+1) * __SUB__->($d_len-1);
         }
     };