When programming, there will naturally be activities we will want to do again and again: adding up the values in an array, stripping extraneous blank spaces from a string, getting information into a hash in a particular format, and so on. It would be tedious to write out the code for each of these little processes every time we need to use one, and maintaining each code segment would be horrific: if there’s a bug in the way we’ve coded the activity, we’ll have to go through and find each one of them and fix it. It would be better if we could define a particular process just once, and then be able to call on that just like we’ve been calling on Perl’s built-in functions.
KeywordsGlobal Variable Return Statement Main Program Area Code Function Argument
Unable to display preview. Download preview PDF.