Filter::exec(3pm)

πŸ’– Filter::exec β€” exec source filter πŸ’–

okay so bestie, welcome to Filter::exec(3pm) β€” it lives in the User Contributed Perl Documentation section, and it is literally a source filter that runs your code through an external command. no cap. let's get into it πŸ¦‹


✨ SYNOPSIS ✨

use Filter::exec qw(command parameters) ;

that's it, that's the whole vibe check πŸ’… you hand it a command and some parameters, and it does the thing.


🌸 DESCRIPTION 🌸

so here's the tea: this filter pipes the current source file through the program which corresponds to the command parameter. that's the whole job. it's giving middleman energy πŸŽ€

and like every other source filter ever, its scope is limited to the current source file only. it's not gonna wander around touching your other files, bestie β€” it stays in its lane. so every single file you want processed by the filter needs to have this

use Filter::exec qw(command ) ;

near the top. yes, every one. no skipping. iykyk πŸ™ˆ

now for the iconic example. here's a script that uses the filter:

use Filter::exec qw(tr XYZ PQR) ;
$a = 1 ;
print "XYZ a = $a\n" ;

and here's what it will output:

PQR = 1

see what happened?? the tr XYZ PQR ate those XYZs right up and turned them into PQRs. the way that it just... works. obsessed πŸ”₯


πŸ’€ WARNING πŸ’€

okay bestie, this is the part where we take our earrings off and get serious for a sec. you should be very careful when using this filter. because of the way the filter is implemented, it is possible to end up with deadlock. like, full-on, nobody's moving, everything's just... stuck. 😭

and be especially careful when stacking multiple instances of the filter in a single source file. that's the high-risk zone right there. 🚨

fr fr, do not just yolo this one. know what you're doing before you stack filters, okay? 🫢

πŸ‘‘ AUTHOR πŸ‘‘

Paul Marquess

(an absolute legend, we stan πŸ’œ)


πŸŽ€ DATE πŸŽ€

11th December 1995.

a vintage icon, truly ✨


and that's the whole page, bestie! 🌈 this one's from perl v5.42.3 and it was pulled on 2026-08-19 β€” so yeah, go forth and filter responsibly, you gorgeous genius πŸ§šπŸ’– slay! πŸ‘‘πŸŒΈ

πŸ“¦ where this page comes from