Perl Programming - Working with Subroutines intro
Get the entire Perl Programming course for 20% off: http://stoneriverelearning.com/courses/perl-programming-for-beginners-online-course?product_id=38639&coupon_code=YOUTUBE20
Welcome back again, guys! Thank you for joining us like always. This is section 5. I’m going to go over the overview and all of the topics that’s described that we’ll learn and develop the beautiful skills and working with subroutines. Let’s dive right into it.
What will you learn in this section? The first topic we’re going to go through is subroutine definitions. I’m going to show you what a subroutine definition looks like and I’m going to explain everything in detail for you guys to develop these subroutine definitions for your own sake and use them.
Our second topic in this section is calling subroutines. After we set up our subroutine and write our definitions, we want to use these subroutines. This is where calling subroutines come in handy.
For our third topic is working with subroutine return values. After setting up these beautiful subroutine definitions and knowing how to call these subroutines in our Perl applications, whenever it’s necessary, sometimes we want to actually return some data from our subroutines. We can actually use these return values or expressions that’s calculated and performed in our subroutines. We can use these values or information inside of a scalar variable and use it in other ways.
Our fourth topic is subroutine arguments. With these subroutine arguments, we’re going to learn how to collect information from the user. Once we have that information from the user, we’re going to be able to perform our implementation or we can use it inside of our definitions of our subroutine to perform some kind of operation or task.
Using variable length parameter lists. Using variable length, we can have a number of different parts of information from a user that we can ask for. We can be limited or we can be unlimited. This is highly used again in Perl because our program doesn’t know how many items our user puts in. So we can use this to determine if we only want two pieces of information passed in to our subroutine to work with or not.
Using the return operator. Again, we can use the return operator to return values, calculate it from an expression within our subroutine definitions, and we can leave that subroutine successfully without performing any other instructions after the return operator within our subroutine.
Private variables in subroutines. I’m going to briefly go over the private scalar variables in subroutines in this section. Private does have an important part within our subroutine.
Lastly, like always, I’m going to give you guys a conclusion to make sure you guys learned all of these beautiful skills in our section and a brief overview of what you’ve learned in our section. I’ll see you guys in our next lecture.