Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: self-feeding infinite loop

by syphilis (Archbishop)
on Aug 18, 2007 at 15:14 UTC ( [id://633491]=note: print w/replies, xml ) Need Help??


in reply to self-feeding infinite loop

For me, it makes no difference to the actual array whether we do push @array, 'a'; or @array = (@array, 'a');.

That is, irrsepective of which alternative we comment out in the following script, the output is the same:
use strict; use warnings; my @array = ('a'); for (@array) { #push @array,'a'; #alternative 1 @array = (@array, 'a'); #alternative 2 print "@array\n"; sleep(1); # so we can absorb what's happening }
Cheers,
Rob

Replies are listed 'Best First'.
Re^2: self-feeding infinite loop
by chromatic (Archbishop) on Aug 18, 2007 at 21:53 UTC
    That is, irrsepective of which alternative we comment out in the following script, the output is the same:

    Well yeah, that's not the problem. The question is whether Perl iterates over a list pushed onto its stack or pulls from the AV, one element at a time. That is only determinate behavior in so far as it depends on the particular version of Perl you're running, and p5p has claimed free rein to change that in the future as necessary.

    Plus also:

    sleep(1); # so we can absorb what's happening

    ... makes me say "Huh?"

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://633491]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2024-04-23 23:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found