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 (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