in reply to Unexpected behaviour of a tied array (Bug in ActiveState Perl?)

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.