2. Idiomatic Perl

Perl is a language designed by a linguist, and as much as any human language, Perl is a language of idioms.

What we call idiomatic Perl is the mixture of elegance and custom that comes naturally to Perl programmers, or we hope at least the majority of them, after experience and experimentation.

Exactly what is idiomatic and what is purely a matter of style or opinion is debatable. There are many different ways to express both simple and complex algorithms in Perl. Some ways, however, are clearly more “right” than others. Although Perl’s motto may be “There’s More Than One Way To Do It,” the corollary is, “But Most of Them Are Wrong,” or “Some Ways Are Better Than Others.”

Idiom and convention are very important in Perl. They ...

Get Effective Perl Programming: Ways to Write Better, More Idiomatic Perl, 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.