Skip to Content
Minimal Perl
book

Minimal Perl

by Tim Maher
October 2006
Beginner
504 pages
12h 58m
English
Manning Publications
Content preview from Minimal Perl

Appendix B. Guidelines for parenthesizing code

In this book, we’ve discussed several situations that require the use of parentheses around code. For easy reference, we provide here a complete summary of the cases that come up most frequently in Minimal Perl.

To demonstrate the benefit of adding your own parentheses, the parentheses you effectively get by default are shown in the comments adjoining the code samples.

You should use parentheses:

  1. Around a function’s arguments, to exclude following elements from that argument list:

    print sort (@F), '!';     # Default: print sort (@F, '!');
  2. Around any multi-element argument list for our or chomp:

    chomp ($X, $Y);           # Default: chomp ($X), $Y;
    
    our   ($X, $Y);           # Default: our   ($X), $Y;
  3. Anywhere the higher precedence of ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Beginning Perl

Beginning Perl

Curtis Ovid Poe
Think Perl 6

Think Perl 6

Laurent Rosenfeld, Allen B. Downey
Perl by Example

Perl by Example

Ellie Quigley
Learning Perl 6

Learning Perl 6

brian d foy

Publisher Resources

ISBN: 9781932394504Publisher SupportOtherPublisher WebsiteSupplemental ContentPurchase Link