Hour 17. Writing Modules

What You'll Learn in This Hour:

In Hour 8, “Functions,” you learned about subroutines. Subroutines allow you to take a frequently used pieces of code and assign it a name to create a small self-contained “mini-program” with its own variables.

After you've written enough programs, you'll find yourself creating the same functions over and over again for tasks. If you write a lot of file-manipulation programs, you'll probably have code to lock files and unlock them in several places; programs with user interaction (prompts and input) will have functions to display prompts, wait for answers, and reject bad input; and programs that work with a particular database might have functions ...

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.