On both 5.005 and 5.6 (Linux) I do not see behaviour like that. Here is my code:
use Devel::Peek; my @a = 1..2; for (my $i = 0; 1; $i++) { print "Stats for $i\n"; Dump(\@a); <STDIN>; push @a, shift @a; }
The line to look for is "ARRAY =..." When there is an offset it will say "(offset=2)". I find it goes 0, 1, 2, then back to 0, then up to 10, back to zero, up to 10, and so on. Now if I try it with an array of 3 elements it goes up to 1, 0-9, 0-25, 0-25, 0-25... With 4 the same thing only it goes up to 24. Etc.

If anyone wants to play with this, here is an easy script to hack around with. Play with the array size and run it as many times as you want...

use strict; use IPC::Open3; my $array_size = shift || 2; my $code = <<'CODE'; use Devel::Peek; my @a = 1..COUNT; for (my $i = 0; 1; $i++) { print STDERR "Iteration=$i\n"; Dump(\@a); print STDERR "\nITERATE\n"; push @a, shift @a; } CODE $code =~ s/COUNT/$array_size/; open3(\*PIPE, ">&STDOUT", \*OUTPUT, "perl") or die "Cannot run perl: $ +!"; $/ = "ITERATE"; print PIPE $code; close PIPE; while (<OUTPUT>) { my $i; if (/Iteration=(\d+)/) { $i = $1; } else { die "Cannot find the iteration in\n$_"; } my $off = /offset=(\d+)/ ? $1 : 0; printf "Iteration%8d: Offset%6d\n", $i, $off; }

In reply to Re (tilly) 3: alternating row colors by tilly
in thread alternating row colors by qball

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.