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

Control statements and looping

by root (Scribe)
on Nov 03, 1999 at 02:58 UTC ( #918=perltutorial: print w/replies, xml ) Need Help??

Perl offers an abundance of looping and control statements. Some quick notes if you're a C, C++, or Java programmer Perl requires curly braces around blocks of code even if your for loop has only one line of code. Secondly, if you're new to programming these control statements test whether a statement is true of false and then control execution of the program based on the results. You might want to look at what is true and false in Perl?

Or you can dive right into the control statements

  • if statements
  • unless statements
  • while loops
  • until loops
  • do while loops
  • do until loops
  • for loops
  • foreach loops
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Node Status?
    node history
    Node Type: perltutorial [id://918]
    help
    Chatterbox?
    [Corion]: ambrus: I did that in 2012 and 2013, to try it out, and I found the available time to be worth more to me than the money
    [Corion]: I've started that again this month (now forever instead of a limited time), and it already destresses me a lot
    [holli]: There are Anti Vaxxer weeks at IKEA.
    [Corion]: Of course, it's a 20% cut in the money I receive, while the work doesn't necessarily reduce at all, but my approach is to make the work take longer instead of fitting 5 days worth of work into 4
    [holli]: 50% off all children coffins.
    [Corion]: holli: Ooof :)
    [hippo]: Cut should beless than 20% after tax, though. :-)
    [Corion]: hippo: Yeah, but at least two years ago, it still was close enough to 20% cut
    [Corion]: But I have a very positive experience with a four day workweek and a three day weekend. I can't easily go back though to full money.
    [Corion]: That is easy without having to pay for a house, a wife or children though. If I had any of these, or any two of these, the decision wouldn't be that easy.

    How do I use this? | Other CB clients
    Other Users?
    Others studying the Monastery: (10)
    As of 2017-09-21 15:08 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      During the recent solar eclipse, I:









      Results (249 votes). Check out past polls.

      Notices?