Skipping content in Array within loop and go to the next (of NEXT function)

Discussion in 'Perl Misc' started by Tad McClellan, May 13, 2004.

  1. Edward Wijaya <> wrote:


    > MYLABEL : foreach $arr1 (@arr1)


    > NEXT MYLABEL:}

    ^
    ^ that does not belong there

    > I want to know if the NEXT



    Surely you meant "next" instead? Case matters you know.


    > is executed the loop continue the subsequent
    > list content or not,
    > or it start all over again by taking the first array value.



    What happened when you tried it?


    Have you read the documentation for next() ?

    perldoc -f next

    ... it starts the next iteration of the loop


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
     
    Tad McClellan, May 13, 2004
    #1
    1. Advertising

  2. Hi,
    If I have this construct

    MYLABEL : foreach $arr1 (@arr1)
    {
    for (my $k=0; $k<100 ;k++)
    while (some expression) {
    if (some expression)
    { do something;
    NEXT MYLABEL:}
    else {do another thing;}
    }
    }

    I want to know if the NEXT is executed the loop continue the subsequent
    list content or not,
    or it start all over again by taking the first array value.

    If the latter is the case, is there anyway I can make the loop continue
    with subsequent
    value instead of starting from the first array?

    Thanks so much for your time.
    Hope to hear from you again.

    Regards
    Edward WIJAYA


    --
    Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
     
    Edward Wijaya, May 13, 2004
    #2
    1. Advertising

  3. Edward Wijaya <> wrote:
    > On Thu, 13 May 2004 00:04:08 -0500, Tad McClellan <>
    > wrote:
    >> Edward Wijaya <> wrote:



    >> What happened when you tried it?

    > It excecute the array's contents and it doesn't
    > give infinite loop. But the output is to large
    > to check whether it satisfy the condition.



    Then try it again with a smaller data set.


    >> Have you read the documentation for next() ?
    >>
    >> perldoc -f next

    > Not the man page, but the Camel Book (Chapter 2.6).



    Don't do that.

    Books are out of date before they are even published.

    The docs that ship with perl are kept current, you should check
    the std docs *first*.

    The std docs are a required resource.

    Books are merely a "nice to have" resource.


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
     
    Tad McClellan, May 13, 2004
    #3
  4. On Thu, 13 May 2004 00:04:08 -0500, Tad McClellan <>
    wrote:
    Hi

    > Edward Wijaya <> wrote:
    >
    >
    >> MYLABEL : foreach $arr1 (@arr1)

    >
    >> NEXT MYLABEL:}

    > ^
    > ^ that does not belong there
    >
    >> I want to know if the NEXT

    >
    >
    > Surely you meant "next" instead? Case matters you know.

    Yes. Sorry for my carelessness, Tad. Thanks for pointing
    it out.


    >
    >
    >> is executed the loop continue the subsequent
    >> list content or not,
    >> or it start all over again by taking the first array value.

    >
    >
    > What happened when you tried it?

    It excecute the array's contents and it doesn't
    give infinite loop. But the output is to large
    to check whether it satisfy the condition.

    >
    >
    > Have you read the documentation for next() ?
    >
    > perldoc -f next

    Not the man page, but the Camel Book (Chapter 2.6).


    >
    > ... it starts the next iteration of the loop


    Admit I was uncareful to notice and interpret
    that statement in that book. Thanks Tad.

    >
    >




    --
    Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
     
    Edward Wijaya, May 13, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. branton ellerbee

    sqlDataReader skipping first row in loop

    branton ellerbee, Jun 2, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    6,338
    Teemu Keiski
    Jun 2, 2004
  2. Québec

    for loop skipping items

    Québec, Jul 30, 2004, in forum: C Programming
    Replies:
    7
    Views:
    390
    Keith Thompson
    Jul 31, 2004
  3. Deniz Bahar
    Replies:
    2
    Views:
    490
    Andrey Tarasevich
    Mar 9, 2005
  4. Chris R.
    Replies:
    3
    Views:
    145
    Adam Prescott
    Jan 28, 2011
  5. Isaac Won
    Replies:
    9
    Views:
    397
    Ulrich Eckhardt
    Mar 4, 2013
Loading...

Share This Page