Perl::C...arewords(3)

πŸ“¦
version 0.07 Β· 2 versions
, in fedora 43

✨ NAME ✨

Perl::Critic::Policy::CodeLayout::ProhibitHashBarewords β€” okay bestie, this is the manual page for that policy, and it is literally about one thing: making your hash keys wear quotes πŸ’…


πŸŽ€ AFFILIATION πŸŽ€

This policy is part of Perl::Critic::Itch. That's its whole home base, no cap 🫢


πŸ¦‹ VERSION πŸ¦‹

0.07 β€” that's the one we're talking about here ⭐


🌸 DESCRIPTION 🌸

So, the vibe of this Policy is simple: it forces (single) quotes on all hash keys barewords. Like, all of them. No exceptions, periodt πŸ‘‘

When you're specifying constant string hash keys, you should use (single) quotes. For example:

$my_hash{'some_key'}

Why tho? Because it results in consistent formatting β€” iconic behavior, honestly. And also because if you forget to use quotes sometimes, you have to remember to add them when your key contains internal hyphens, spaces, or other special characters. Which is giving "I forgot and now everything is on fire" energy 😭

Quoted keys are also more likely to be syntax-highlighted by your editor, which is lowkey a glow-up for your whole file ngl ✨


πŸ’– INTERFACE πŸ’–

Standard for a Perl::Critic::Policy. That's it, that's the interface, she's simple and she knows it πŸŽ€


🌈 ACKNOWLEDGMENTS 🌈

Thanks to:

  • Jose Carlos Pereira for pointing me in the right direction! 🫢
  • All Perl::Critic::Policy contributors. Their code examples were quite useful. Fr fr, absolute legends πŸ‘‘

perl v5.42.0 Β· 2025-07-25 β€” and that's the tea, bestie πŸ’œ go forth and quote your hash keys, your future self will thank you, iykyk πŸ¦‹πŸ’…

πŸ“¦ where this page comes from