logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Perl::Critic::Policy::References::ProhibitDoubleSigils - Write "@{ $array_ref }" instead of

Affiliation

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

Author

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

Configuration

       This Policy is not configurable except for the standard options.

Description

       When dereferencing a reference, put braces around the reference to separate the sigils.  Especially for
       newbies, the braces eliminate any potential confusion about the relative precedence of the sigils.

         push @$array_ref, 'foo', 'bar', 'baz';      #not ok
         push @{ $array_ref }, 'foo', 'bar', 'baz';  #ok

         foreach ( keys %$hash_ref ){}               #not ok
         foreach ( keys %{ $hash_ref } ){}           #ok

Name

       Perl::Critic::Policy::References::ProhibitDoubleSigils - Write "@{ $array_ref }" instead of
       "@$array_ref".

See Also