in reply to seeking advice on loops

Your questions haven't even been proof read.
1) Think about that.
1) You could use a while(), or do{}while() for the input and a foreach() for the output


Evan Carroll
www.EvanCarroll.com

Replies are listed 'Best First'.
Re^2: seeking advice on loops
by prad_intel (Monk) on Oct 07, 2005 at 05:08 UTC
    You could look at the poll results of

    "If I was forced to use only one kind of loop for the rest of my days it would be a ...."

    It could help you better in what monks feel the most powerful loop.

    prad

    PERL is the only language i know and i dont want to know the rest.

      You could look at the poll results of

      "If I was forced to use only one kind of loop for the rest of my days it would be a ...."

      Perhaps a link would help, since the person you're responding to is a PM newbie.

      It could help you better in what monks feel the most powerful loop.
      If this is supposed to be sarcastic, then fine. If it's not, then I doubt it would really help. In particular the most voted option has been (as of this writing): "matter of time 'til I killed the bastard who forced me to do it".

      Indeed the joke does stress that TMTOWTDI rules. More seriously, the two most often used loops in Perl are IMO while and for. Matter is they excel in two different kind of loops. Typically, but not exclusively of course, the former for iterating over filehandles (such a typical operation in Perl!) and the latter over fixed length lists -- but beware of redo, last and next!

      Incidentally we may note here that in Perl6 we will have for commonly used for both kind of situations, with the help of lazy lists and similar magic...

      prad

      PERL is the only language i know and i dont want to know the rest.

      Is this supposed to be a .sig? Then you should do us all a favour and render it in a visually distinctive manner, e.g. a smaller font, to help us not be distracted by it and consider it part of your actual post.

      BTW: quite sad that such a claim is about "PERL", especially since there's not such a thing. Please check

      perldoc -q 'difference between "perl" and "Perl"'
      (also available here.)