Perl::Critic::Policy::ValuesAndExpressions::ProhibitEmptyQuotes - Write C instead of C<''>.


Perl-Critic documentation  | view source Contained in the Perl-Critic distribution.

Index


NAME

Top

Perl::Critic::Policy::ValuesAndExpressions::ProhibitEmptyQuotes - Write q{} instead of ''.

AFFILIATION

Top

This Policy is part of the core Perl::Critic distribution.

DESCRIPTION

Top

Don't use quotes for an empty string or any string that is pure whitespace. Instead, use q{} to improve legibility. Better still, created named values like this. Use the x operator to repeat characters.

    $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




CONFIGURATION

Top

This Policy is not configurable except for the standard options.

SEE ALSO

Top

Perl::Critic::Policy::ValuesAndExpressions::ProhibitNoisyStrings (Perl::Critic::Policy::ValuesAndExpressions::ProhibitNoisyStrings)

AUTHOR

Top

Jeffrey Ryan Thalhammer <jeff@imaginative-software.com>

COPYRIGHT

Top


Perl-Critic documentation  | view source Contained in the Perl-Critic distribution.