What loops are available in Perl and how do they work?
- [Voiceover] Generally speaking,…a loop is a piece of code that is repeated.…There's usually a condition…that controls the duration of the loop.…There are several types of loops available in Perl.…This loop which tests its condition before running the code…is called a while loop.…A while loop looks like this in Perl.…It first tests the condition, and then,…if the condition is true, it executes the code.…It then tests the condition again,…and continues executing the code,…over and over again, until the condition is false.…
Execution then continues with the code after the loop.…The until loop works just like the while loop,…but the condition is reversed.…In this case, the loop is executed…while the condition is false,…and execution continues after the loop…when the condition is true.…If you need the code to run at least once,…you may use a do loop.…This works with either while or until conditions.…In this case, the loop control condition…is tested after the code runs.…
Perl also provides a C-style for loop.…If you use C or C++, this loop is probably familiar.…
Watch to learn the details of the Perl syntax, from variables, conditionals, loops, and data structures to regular expressions, functions, and references. A quick-start guide is included for experienced developers who want to get up and running with Perl 5 fast, and the entire course is recommended for both new and experienced programmers alike. Later chapters cover file handling and reusing code with Perl modules, plus Perl best coding practices.
- Understanding Perl's general syntax and the anatomy of a Perl script
- Writing statements and expressions
- Creating assignments
- Working with variables and strings
- Using data types effectively
- Defining logical flow with conditionals and loops
- Using special variables
- Using Perl operators
- Performing simple Perl programming tasks with expressions
- Matching data
- Defining and calling functions
- Using references
- Handling files in the file I/O
- Using built-in functions
- Reusing code with modules
- Coding with Perl best practices
Skill Level Intermediate
1. Setting Up
About Perl3m 36s
2. Quick Start
3. Basic Syntax
4. Values and Variables
7. Special Variables
9. Regular Expressions
11. References and Structures
12. File I/O
13. Built-In Functions
15. Best Practices
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.