When programming, naturally there are activities we 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 it, and maintaining each code segment would be horrific: if there’s a bug in the way we’ve coded the activity, we have to go through and find it each time and fix it. Wouldn’t it be better if we could define a particular process just once, and then be able to call on it whenever we need to, just like we call on Perl’s built-in functions?
KeywordsGlobal Variable Return Statement Main Program Area Code Function Argument
Unable to display preview. Download preview PDF.