# New Ticket Created by  "Stephen Simmons" 
# Please include the string:  [perl #58340]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=58340 >


The attached fibonacci program seems to have some strange behavior in the
loop.  There are two variables, $i, and $j, which contain the state, and $t
which saves $i temporarily.
In the first iteration of the loop, the output is
0 1 1

which is correct.

But the second iteration produces
2 2 2
instead of
1 1 2

And the rest are:
4 4 4
8 8 8
16 16 16
32 32 32
64 64 64
128 128 128
256 256 256
512 512 512
1024 1024 1024

which all show the same incorrect behavior as the second iteration.  It is
almost as if the assignment statements, the second time through start
binding variables together.

Stephen Simmons

System Information:

sully:experiment stephensimmons$ perl6 -v
This is Rakudo Perl 6, revision 30524 built on parrot 0.7.0-devel
for darwin-thread-multi-2level.

Copyright 2006-2008, The Perl Foundation.

sully:experiment stephensimmons$ uname -a
Darwin sully.local 9.4.0 Darwin Kernel Version 9.4.0: Mon Jun  9 19:30:53
PDT 2008; root:xnu-1228.5.20~1/RELEASE_I386 i386

Attachment: fibonacci.p6
Description: Binary data

Reply via email to