Filter::sh(3pm)

✨ NAME ✨

Filter::sh β€” a lil sh source filter that rewrites your Perl before Perl ever sees it πŸ’…

(it lives in the User Contributed Perl Documentation section of the manual, bestie β€” page Filter::sh(3pm))


🌸 SYNOPSIS 🌸

use Filter::sh 'command' ;

That's it. That's the whole vibe. πŸŽ€


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so here's the tea β˜• β€” this filter takes your current source file and pipes it straight through the program that your command parameter names, running it via the Bourne shell. So like. Your Perl gets a glow-up from a shell command before it's even compiled. iconic behavior honestly ✨

Now, important thing β€” like every single source filter ever β€” its scope is limited to the current source file only. No sneaky spreading to other files. Every file you want the filter to touch needs its own

use Filter::sh 'command' ;

sitting near the top. no exceptions, no shortcuts, fr fr πŸ™ˆ

Here's an example script that uses the filter:

use Filter::sh 'tr XYZ PQR' ;
$a = 1 ;
print "XYZ a = $a\n" ;

and here's what it spits out πŸ‘‡

PQR = 1

see how tr XYZ PQR just swapped those letters out? ate and left no crumbs πŸ“


πŸ’€ WARNING πŸ’€

bestie please be careful with this one. 😭

You should be very careful when using this filter. Because of the way the filter is implemented, it is possible to end up with a deadlock. That's not a vibe. That's the opposite of a vibe. πŸ’€

And be especially careful when you're stacking multiple instances of the filter inside a single source file. Stack 'em and you might just lock everything up. the math is not mathing in your favor, ngl πŸ™ˆ


πŸ‘‘ AUTHOR πŸ‘‘

Paul Marquess wrote this one. legend behavior, no cap. 🫢


⭐ DATE ⭐

11th December 1995. yes bestie, a vintage. it was slaying before most of us could walk πŸ’…βœ¨


k bye, and remember β€” this page came to you from perl v5.42.3, dated 2026-08-19, filed under Filter::sh(3pm) in the User Contributed Perl Documentation. mwah πŸŽ€πŸ’–

πŸ“¦ where this page comes from