Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2024-04-19 10:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found