Perl::...ulation(3pm)

πŸ“¦
version 1.0.4 Β· 4 versions
, in debian trixie, ubuntu resolute, ubuntu stonking

πŸ’… 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 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