Perl::...ulation(3pm)
π NAME π
Perl::Critic::Policy::Community::MultidimensionalArrayEmulation β bestie, pls stop doing multidimensional array emulation, it's giving 1998 π¦
β¨ DESCRIPTION β¨
okay so picture this: you've got a list inside a hash subscript ({}), and when you use it with the @ or % sigils, it reaches into multiple elements of the hash at once β that's a slice, iconic behavior, we love her π
but with the $ sigil?? suddenly it's only grabbing one single element, at the key you get by joining that whole list together with the subscript separator $;. and that, my love, is the thing perldata calls "Multi-dimensional array emulation" π«Ά
back in the day this was the way to fake a multidimensional structure before Perl 5 brought references into the world. but now? Perl has true multidimensional structures, so this trick is lowkey unnecessary in most cases. we've moved on, and honestly? we're better for it β¨
if you're on Perl 5.34 or newer β or automatically under use v5.36 or newer β you can disable "The 'multidimensional' feature" in feature and just... yeet this syntax straight out of 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
see how the top two are not ok and the bottom two are ok?? main character energy only in the bottom half π
πΈ AFFILIATION πΈ
this policy is part of Perl::Critic::Community. she runs with her girls π«Ά
π CONFIGURATION π
ngl this policy is not configurable β like, at all β except for the standard options. that's it, that's the whole tea β
π AUTHOR π
Dan Book, dbook@cpan.org β thank u king π
π COPYRIGHT AND LICENSE π
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. periodt π
π SEE ALSO π
Perl::Critic
ok bestie that's the whole page, no notes, you ate π β¨
mwah, this was perl v5.40.1, dated 2025-03-22, straight from the Perl::...ulation(3pm) page β User Contributed Perl Documentation, iykyk π¦
π¦ where this page comes from
- debian trixie: libperl-critic-community-perl 1.0.4-1 Β· Artistic-2.0
- ubuntu resolute: libperl-critic-community-perl 1.0.4-1 Β· Artistic-2.0
- ubuntu stonking: libperl-critic-community-perl 1.0.4-1 Β· Artistic-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms