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::Community::MultidimensionalArrayEmulation - Don't use multidimensional array

Affiliation

       This policy is part of Perl::Critic::Community.

Author

       Dan Book, "dbook@cpan.org"

Configuration

       This policy is not configurable except for the standard options.

Description

       When used with the "@" or "%" sigils, a list in a hash subscript ("{}") will access multiple elements of
       the hash as a slice. With the "$" sigil however, it accesses the single element at the key defined by
       joining the list with the subscript separator $;. This feature is known as "Multi-dimensional array
       emulation" in perldata and provided a way to emulate a multidimensional structure before Perl 5
       introduced references. Perl now supports true multidimensional structures, so this feature is now
       unnecessary in most cases.

       In Perl 5.34 or newer, or automatically under "use v5.36" or newer, ""The 'multidimensional' feature" in
       feature can be disabled to remove this syntax from the parser.

         $foo{$x,$y,$z}   # not ok
         $foo{qw(a b c)}  # not ok
         $foo{$x}{$y}{$z} # ok
         @foo{$x,$y,$z}   # ok

Name

       Perl::Critic::Policy::Community::MultidimensionalArrayEmulation - Don't use multidimensional array
       emulation

See Also

       Perl::Critic

perl v5.40.1                                       2025-03-22              Perl::Critic::...lArrayEmulation(3pm)

See Also