Programming Basics

  Home arrow Programming Basics arrow Loop Control Constructs

Loop Control Constructs
By: Apress Publishing
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating:  stars stars stars stars stars / 0

    Table of Contents:
  • Loop Control Constructs
  • Loop Control Constructs



    Loop Control Constructs

    (Page 1 of 2 )

    In this eighth part of a nine-part article series on control flow structures in Perl, you'll learn how to modify expressions with "while" and how to create loop control constructs. This article is excerpted from chapter three of the book Beginning Perl, Second Edition, written by James Lee (Apress; ISBN: 159059391X).

    Expression Modifying

    As before, you can usewhileas a statement modifier. Following the pattern forif, here’s what you’d do withwhile:

    while ( condition ) { statement }


    statement while condition;


    until ( condition ) { statement }


    statement until condition;

    Therefore, this loop:

    while (<STDIN>) {
    print "You entered: $_";

    can be written as

    print "You entered: $_" while <STDIN>;

    More Programming Basics Articles
    More By Apress Publishing

    blog comments powered by Disqus


    - The Transliteration Operator in Perl
    - Perl String Processing Functions
    - Perl String Processing
    - Control Flow Constructs: Loops Conclusion
    - Loop Control Constructs
    - Control Flow Constructs: the For and Foreach...
    - Loops and Control Flow Constructs
    - Expression Modifiers for Perl Control Flow C...
    - Logical Operators and Control Flow Constructs
    - Comparing Strings with Control Flow Construc...
    - Perl Operators and Control Flow Constructs
    - Control Flow Constructs
    - More Time Manipulation with PHP
    - Validating and Manipulating Dates with PHP
    - Using the Date Constructor in PHP

    Developer Shed Affiliates


    © 2003-2019 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap