Q&A

Q1: All these different variable characters! How can I keep them straight!
A1: The more you use them, the easier it'll be to remember which one is used where. If it helps, you can think of the scalar variable character $ as a dollar sign—dollars are numbers, and are scalar. The at sign (@) is a sort of A character—A stands for array. And the percent sign (%) for hashes has a slash with two dots—one dot for the key, and one for the value. In array and hash element accesses, think of what you want the result of the expression to be: if you want a single element, use $.
Q2:Hashes are just plain associative arrays, aren't they? They aren't actual hash tables?
A2: Hashes are indeed sometimes called associative arrays, and were called that in previous ...

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.