Perl::...Sigils(3pm)
π Perl::...Sigils(3pm) β the whole vibe
okay bestie, so this page is from the Perl::...Sigils(3pm) manual, and honestly? It's a lil policy page with big main-character energy. Let's get into it. β¨
πΈ NAME
Perl::Critic::Policy::References::ProhibitDoubleSigils β write "@{ $array_ref }" instead of "@$array_ref". That's it, that's the whole thing. π
π AFFILIATION
This Policy is part of the core Perl::Critic distribution. So like, it ships with the squad β you don't have to go hunting for it. π«Ά
β¨ DESCRIPTION
okay so here's the tea: when you're dereferencing a reference, put braces around the reference to separate the sigils. Literally just wrap it. π
Especially for newbies, the braces eliminate any potential confusion about the relative precedence of the sigils. No cap β those lil sigils get confusing and the braces are the vibe check that keeps everything clear. π
Here's the glow-up, side by side:
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
See how the right column just ate? π Braces on, confusion gone. π¦
π§ CONFIGURATION
This Policy is not configurable except for the standard options. That's it. Nothing to tweak, nothing to customize β she comes as she is. π
π AUTHOR
Jeffrey Ryan Thalhammer <jeff@imaginative-software.com>
(genuine icon behavior, we love to see it π«Ά)
π COPYRIGHT
Copyright (c) 2005-2023 Imaginative Software Systems. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of this license can be found in the LICENSE file included with this module. π
okay that's the whole page, bestie β go forth and brace your sigils, it's giving clean code energy fr fr πΈπ
perl v5.42.0 Β· 2024-10-23 β mwah, that's the source/version and date, we stan a documented timestamp πβ¨
π¦ where this page comes from
- opensuse-leap 16.0: perl-Perl-Critic 1.156.0-bp160.1.1 Β· Artistic-1.0 OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms