4.1. Syntactical Sugaring

Perl has an unjustified reputation as a write-only language. We suspect this is because programmers who have never seen it before think they should be able to understand what's going on the first time they lay eyes on a statement the way they could with a BASIC program. But Perl provides many concise idioms and syntactic shortcuts that make programs much shorter than they would have been, and all you need is enough familiarity with the idioms.

4.1.1. The Variable That Wasn't There

A frequent source of bafflement for newcomers is the way that Perl programs seem to be talking to themselves:

while (<STDIN>)
   {
   chomp;
   s/#.*//;
   next unless /\S/;
   # ...
   }

This apparently defies the usual paradigm of functions operating on ...

Get Perl Debugged 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.