Skip to content
Back to skills

Perl Patterns

ASecurity

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\".

  • 2 stars
  • 0 votes
  • 0 copies
  • 6 views
  • Added September 19, 2026
ai-agentspythongoexpressrefactoringsecurity

Security analysis

A100/100

Pro scans all 9 files and shows the line behind each finding

Scanned September 19, 2026

npx -y skills add majinmagros/magros.ai-skills --skill perl-patterns --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Perl Patterns?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Perl Patterns
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/majinmagros-perl-patterns/badge)](https://www.skillsdirectory.com/skills/majinmagros-perl-patterns)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
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.md2.5 KB
  • references/core-principles.md2.1 KB
  • references/data-structures.md776 B
  • references/error-handling.md753 B
  • references/file-io.md744 B
  • references/modern-oo.md1.6 KB
  • references/modules.md926 B
  • references/regex.md761 B
  • references/tooling.md1019 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.