Some more fuel for the fire:

The following code gives the same double result

... my $o = ""; foreach ( @array ) { $o .= $_.' '; } print $o."\n";
whereas omitting the .' ' as in the code below doesn't so its not part of the "" mechanism exactly.
... my $o = ""; foreach ( @array ) { $o .= $_; } print $o."\n";
If you modify your FETCH routine (more code below) to return an integer count for each time its called then you see that the calls used are the second ones. It is bizarre why Activestate should call the routine twice but it looks to me like a BUG as if you were using a more bizarre backend such as a network socket you'd be missing data.
my $c = 0; sub FETCH { my $self = shift; my $index = shift; $c++; print STDERR "Call ($c) fetching the element with index: $index\n" +; return $self->[ $index ].$c; }
produces
Call (1) fetching the element with index: 0
Call (2) fetching the element with index: 0
Call (3) fetching the element with index: 1
Call (4) fetching the element with index: 1
Perl2 Monks4 

Dingus


Enter any 47-digit prime number to continue.

In reply to Re: Unexpected behaviour of a tied array (Bug in ActiveState Perl?) by dingus
in thread Unexpected behaviour of a tied array (Bug in ActiveState Perl?) by larsen

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.