Perl Style: Avoid Gratuitous Backslashes

  • Perl lets you choose your own delimiters on quotes and patterns to avoid Leaning Toothpick Syndrome. Use them.

        m#^/usr/spool/m(ail|queue)#
    
        qq(Moms said, "That's all, $kid.")
    
        tr[a-z]
          [A-Z];
    
        s { /          }{::}gx;
        s { \.p(m|od)$ }{}x;
    

Forward to Reduce Complexity
Back to Avoid Testing eof
Up to index

Copyright © 1998, Tom Christiansen All rights reserved.

Tags

Feedback

Something wrong with this article? Help us out by opening an issue or pull request on GitHub

TPRF Gold Sponsor
TPRF Silver Sponsor
TPRF Bronze Sponsor