O'Reilly logo

Sams Teach Yourself Perl in 21 Days, Second Edition by Rafe Colburn, Laura Lemay

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

List and Scalar Context

Before we leave arrays behind, I'd like to pause significantly to discuss the subject of context. Context, in Perl, is the notion that different bits of data act differently depending on what you're trying to do with them. Context can be particularly baffling to understand, and if you're confused about context you can end up with results that seem to make absolutely no sense (or bits of other people's scripts that produce results seemingly out of nowhere). On the other hand, when you understand context in Perl, and how different operations use context, you can do very complex things very quickly, which would take several lines of code in other languages.

Note

If you're an experienced programmer and you've been scanning ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required