Back to skills
SKILL.md
Perl Patterns
ASecurityUse when modern Perl 5.36+ idioms, best practices, and conventions for building robust, maintainable Perl applications. Only for Perl — not for other languages. Triggers on \"perl-patterns\", \"perl patterns\", \"patterns\".
- 2 stars
- 0 votes
- 0 copies
- 6 views
- Added September 19, 2026
Security analysis
100/100Pro scans all 9 files and shows the line behind each finding
npx -y skills add majinmagros/magros.ai-skills --skill perl-patterns --agent claude-codeAre you the author of Perl Patterns?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/majinmagros-perl-patterns)---
name: perl-patterns
description: "Use when modern Perl 5.36+ idioms, best practices, and conventions for building robust, maintainable Perl applications. Only for Perl — not for other languages. Triggers on \"perl-patterns\", \"perl patterns\", \"patterns\"."
metadata:
origin: ECC
---
# Modern Perl Development Patterns
Idiomatic Perl 5.36+ patterns and best practices for building robust, maintainable applications.
## When to Activate
- Writing new Perl code or modules
- Reviewing Perl code for idiom compliance
- Refactoring legacy Perl to modern standards
- Designing Perl module architecture
- Migrating pre-5.36 code to modern Perl
## When NOT to Use
- Other languages (use `python-patterns`, `golang-patterns`, etc.)
- Perl security review specifically (use `perl-security`)
## How It Works
Apply these patterns as a bias toward modern Perl 5.36+ defaults: signatures, explicit modules, focused error handling, and testable boundaries. The examples below are meant to be copied as starting points, then tightened for the actual app, dependency stack, and deployment model in front of you.
## Contents
| Topic | Reference |
|---|---|
| Core principles (pragma, signatures, context, deref, `isa`) | `references/core-principles.md` |
| Error handling (eval/die, Try::Tiny, try/catch) | `references/error-handling.md` |
| Modern OO (Moo, roles, native class) | `references/modern-oo.md` |
| Regular expressions | `references/regex.md` |
| Data structures and references | `references/data-structures.md` |
| File I/O (three-arg open, Path::Tiny) | `references/file-io.md` |
| Module organization and Exporter | `references/modules.md` |
| Tooling (perltidy, perlcritic, carton) | `references/tooling.md` |
## Quick Reference: Modern Perl Idioms
| Legacy Pattern | Modern Replacement |
|---|---|
| `use strict; use warnings;` | `use v5.36;` |
| `my ($x, $y) = @_;` | `sub foo($x, $y) { ... }` |
| `@{ $ref }` | `$ref->@*` |
| `%{ $ref }` | `$ref->%*` |
| `open FH, "< $file"` | `open my $fh, '<:encoding(UTF-8)', $file` |
| `blessed hashref` | `Moo` class with types |
| `$1, $2, $3` | `$+{name}` (named captures) |
| `eval { }; if ($@)` | `Try::Tiny` or native `try/catch` (5.40+) |
| `BEGIN { require Exporter; }` | `use Exporter 'import';` |
| Manual file ops | `Path::Tiny` |
| `blessed($o) && $o->isa('X')` | `$o isa 'X'` (5.32+) |
| `builtin::true / false` | `use builtin 'true', 'false';` (5.36+, experimental) |
## Anti-Patterns
```perl
# 1. Two-arg open (security risk)
open FH, $filename; # NEVER
# 2. Indirect object syntax (ambiguous parsing)Files in this skill
- SKILL.md
- references/core-principles.md
- references/data-structures.md
- references/error-handling.md
- references/file-io.md
- references/modern-oo.md
- references/modules.md
- references/regex.md
- references/tooling.md
Attribution
Related skills
View all in ai-agents →Comments
Loading comments…
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.