Perl::...yQuotes(3pm)
β¨ NAME β¨
okay so this is Perl::...yQuotes(3pm) β a user-contributed Perl doc page, and the actual policy main character is Perl::Critic::Policy::ValuesAndExpressions::ProhibitEmptyQuotes. The whole vibe? Write q{} instead of ''. Periodt. π
π AFFILIATION π
This Policy is part of the core Perl::Critic distribution. So itβs not some random side quest β it ships with the core crew. π«Ά
π¦ DESCRIPTION π¦
Bestie, do not use quotes for an empty string or any string that is pure whitespace. Instead, use q{} to improve legibility. Even better? Make named values like this. And use the x operator to repeat characters. Obsessed with how clean that is.
$message = ''; #not ok
$message = ""; #not ok
$message = " "; #not ok
$message = q{}; #better
$message = q{ } #better
$EMPTY = q{};
$message = $EMPTY; #best
$SPACE = q{ };
$message = $SPACE x 5; #best
The #not ok ones are literally not it; #better is the glow-up; #best is the final form. π₯
πΈ CONFIGURATION πΈ
No extra knobs here, bestie: this Policy is not configurable except for the standard options. fr fr. π
π SEE ALSO π
Perl::Critic::Policy::ValuesAndExpressions::ProhibitNoisyStrings
π AUTHOR π
Jeffrey Ryan Thalhammer <jeff@imaginative-software.com>
π COPYRIGHT π
Copyright (c) 2005-2011 Imaginative Software Systems. All rights reserved.
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.
Sign-off time, bestie: this page is from perl v5.42.0, dated 2024-10-23 β mwah ππ«Ά
π¦ 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