# New Ticket Created by (Mark A. Hershberger) # Please include the string: [perl #61902] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=61902 >
I was working on Euler problem 2 (http://projecteuler.net/index.php?section=problems&id=2), trying to set up a Fibonacci class when I discovered the following strange behavior. The code to my solution works under Pugs and produces the following output: 2,8,34,144,610,2584,10946,46368,196418,832040,3524578 4613732 Under rakudo, I get the following output: Use of uninitialized value (repeated several times — the warning comes from the first line in the next() method) 5702887,5702887,5702887,5702887,5702887,5702887,5702887,5702887,5702887,5702887,5702887 62731757 Here's the source: -=-=- cut -=-=- #!perl6 class Fibonacci { has @!list is rw = (0, 1); method next() { @!list[2] = [+] @!list; shift @!list; return @!list[1]; } } my $fibber = Fibonacci.new; my $f; my @r = gather { $f = $fibber.next; while($f < 4000000) { take $f if $f % 2 == 0; $f = $fibber.next; } } say @r.join(","); say [+] @r;