Summary

Today's lesson has covered a few topics that might be considered somewhat esoteric, but will become more important as the remainder of this book unfolds. The first half of this lesson discussed aspects of variables and scope, including what a global variable means when there are packages to restrict it from being truly global, and making sure your global variables are local to a script by defining them with my.

Then, we turned to local variables, and you learned more about the use of my variables inside blocks and subroutines, as well as defining local variables with local.

Given all these choices for declaring and using different variables, it's confusing to know what's right. Among Perl programmers, there are general rules and practices ...

Get Sams Teach Yourself Perl in 21 Days, Second 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.