Hour 8. Functions

What You'll Learn in This Hour:

Almost all computer languages support functions. A function is a grouping of code statements that can be called by name to do some work and then return some value. You've been using functions throughout this book; for example, you've used print, chomp, sort, open, close, split, and so on. These functions are built into Perl.

Perl also allows you to write your own functions. In Perl, user-defined functions are called subroutines, or subs. Like Perl's built-in functions, user-defined functions can take arguments and return values to the caller. ...

Get SAMS Teach Yourself Perl in 24 Hours THIRD EDITION now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.