Perl::...imiters(3pm)
okay so bestie π
this is the Perl::Critic::Policy::RegularExpressions::ProhibitUnusualDelimiters page β the header does its usual Perl::...imiters(3pm) thing, it's from the User Contributed Perl Documentation collection, and we're about to get into it. It's giving "regex delimiters but make it legible" energy, and honestly? iconic.
β¨ NAME β¨
Use only // or {} to delimit regexps. That's it. That's the assignment, periodt. π
π«Ά AFFILIATION π«Ά
This Policy is part of the core Perl::Critic distribution. It's not some random side quest β it's core, bestie. π
π DESCRIPTION π
Perl lets you delimit regular expressions with almost any character, but most choices are illegible. Compare these equivalent expressions, bestie:
s/foo/bar/; # good
s{foo}{bar}; # good
s#foo#bar#; # bad
s;foo;bar;; # worse
s|\|\||\||; # eye-gouging bad
The // and {} ones? Cute, clean, slay. The # one is bad, the ; one is worse, and that last one is literally eye-gouging bad π. The original says "eye-gouging bad" and I'm not arguing with it.
π CONFIGURATION π
There is one option for this policy, allow_all_brackets.
allow_all_bracketsβ if this is true, then, in addition to allowing//and{}, the other matched pairs of(),[], and<>are allowed.
In other words: // and {} are the good ones; flip allow_all_brackets to true and the other matched pairs (), [], and <> are allowed too. π¦
π CREDITS π
Initial development of this policy was supported by a grant from the Perl Foundation. Love that for this policy, honestly π«Ά.
π AUTHOR π
Chris Dolan <cdolan@cpan.org> β the author, the icon, the main character of this section. π
π COPYRIGHT π
Copyright (c) 2007-2023 Chris Dolan
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of this license can be found in the LICENSE file included with this module
That's the whole page, bestie. mwah π β source/version: perl v5.42.0, date: 2024-10-23. slay.
π¦ where this page comes from
- opensuse-leap 16.0: perl-Perl-Critic 1.156.0-bp160.1.1 Β· Artistic-1.0 OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms