in reply to Re^2: Processing a dynamic array
in thread Processing a dynamic array

That was my fault to make up the link thing ;-) Sometime, you thought you read certain things, but they are not there.

That's fine. The whole purpose was to simulate your situation: a growing array where the growing eventually stops.

Replies are listed 'Best First'.
Re^4: Processing a dynamic array
by lampros21_7 (Scribe) on Oct 29, 2005 at 21:20 UTC
    Hey, i have been trying what pg has recommended but it doesn't seem to work. I have added
    my $first = shift @links; push @links, $first / 2 if (!($first % 2));
    at the end my loop and obviously it gives me the error Argument "http://www.perlmonks.com/" isn't numeric in modulus (%) which makes sense. Then i try just putting
    my $first = shift @links; push @links, $first;
    at the end of my code but that doesn't seem to work either.

    The way i see it, when we shift $first from an array and add it to the end of the array doesn't that mean that $first will be processed again after all the current elements are processed, when we reach that again? I might have the wrong idea for this so could someone please explain? Thanks in advance P.S: The "Argument "http://www.perlmonks.com/" isn't numeric in modulus (%)" is only for reference i havent used the perlmonks website in my loop!!

      That was just my way of easily simulates a growing array. In my simulation code, array elements are numbers. If you copy and paste my code without understanding it and much thinking, and start to divide an URL by 2, Perl obviously does not like it.

      You need to go back to my original reply, and understand my point, as well as other replies (from other monks).