DOKK / manpages / debian 12 / libperl-critic-community-perl / Perl::Critic::Policy::Community::MultidimensionalArrayEmulation.3pm.en
Perl::Critic::Policy::Community::MultidimensionalArrayEmulation(3pm) User Contributed Perl Documentation Perl::Critic::Policy::Community::MultidimensionalArrayEmulation(3pm)

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

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.

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

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

This policy is not configurable except for the standard options.

Dan Book, "dbook@cpan.org"

Copyright 2015, Dan Book.

This library is free software; you may redistribute it and/or modify it under the terms of the Artistic License version 2.0.

Perl::Critic

2022-07-27 perl v5.34.0