From the course: Perl 5 Essential Training
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
The default variable - Perl Tutorial
From the course: Perl 5 Essential Training
The default variable
- [Voiceover] Perl uses special variables for a number of purposes, including default values, parameter passing, process control, and configuration options. The default value variable is used frequently. If you've been following along, you've probably seen this pattern already. Down here on line 8 it says, say foreach @array, and this is the post fix version of the foreach loop and it prints out every value in the array with the say function, so when I run this, you see, it prints out one, two, three, four, five, which is how we've initialized this array using the quote word operator with the five values one, two, three, four, and five. This actually uses the default value variable. Most people just refer to it as the default variable, even though there are a couple other ones that are arrays that are used in different ways, but this is often referred to as the default variable because it is used so commonly. Let's take a look at how this works. I'm going to go ahead and replace this…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.