The Japh Tradition
THE ONE-LINERLooks like someone sneezed on a keyboard, right? But run it and you get:print'4A75737420616E6F74686572205065726C206861636B6572' =~s~.{2}~"qq(\\x{$&})"~regex;
Let's crack this thing open.Just another Perl hacker
Part 1: THE HEX BLOB
That's not random garbage. It's hex-encoded ASCII.4A75737420616E6F74686572205065726C206861636B6572
Every two characters represent one letter. The whole blob spells out "Just another Perl hacker" but encoded so you can't just read it.4A = J 75 = u 73 = s 74 = t 20 = (space) ...and so on
Quick way to verify in Perl:
perl -e 'print pack("H*", "4A757374")' # outputs: Just
Part 2: THE TILDE DELIMITERS
Normal regex uses slashes:But Perl lets you use almost any character as a delimiter. We use tildes:s/old/new/
Why? Our replacement string has slashes and quotes in it. Tildes keep things clean. No escaping nightmare.s~old~new~
Also looks cooler. Fight me.
Part 3: THE PATTERN
Dead simple. Match any two characters. That's it..{2}
So we're grabbing the hex blob two characters at a time:. = any character {2} = exactly two of them
Each pair becomes one letter after we transform it.4A, 75, 73, 74, 20, 61, 6E, 6F...
Part 4: THE REPLACEMENT STRING
Here's where it gets spicy:Let's unpack this onion."qq(\\x{$&})"
$& is a special variable. It holds whatever the regex just matched. So when we match "4A", $& contains "4A".
The replacement builds a string that looks like:
That double backslash (\\) becomes a single backslash in the output.qq(\x{4A})
So after the FIRST eval pass, we have:
Which is valid Perl code. A qq() string containing a hex escape.qq(\x{4A})
Part 5: THE MODIFIERS (THE REAL TRICK)
Look at those modifiers. Now look again.~regex
They spell "regex". While being regex modifiers. In a regex.r - e - g - e - x
Your brain should hurt a little. That's normal..--. |o_o | |:_/ | // \ \ (| | ) /'\_ _/`\ \___)=(___/
But here's what they actually DO:
The x is just along for the ride. It's there to spell the word.r = Return the result (don't modify original string) e = Evaluate replacement as Perl code g = Global (do it for every match, not just the first) e = Evaluate AGAIN (the second e, hidden in "regex") x = Extended mode (allows whitespace in pattern - unused here)
Part 6: THE DOUBLE EVAL (ee)
This is the actual sorcery. Most people miss it.See those two e's in "regex"? That's double eval.
Here's how it flows for the hex pair "4A":
One e would just give you the literal text "qq(\x{4A})". Two e's actually runs it and converts the hex.MATCH: "4A" FIRST e (eval): Evaluates "qq(\\x{$&})" as code $& is "4A" Result: the STRING qq(\x{4A}) SECOND e (eval again): Evaluates qq(\x{4A}) as code Perl sees \x{4A} inside quotes Interprets it as hex escape Result: "J" OUTPUT: J
Part 7: PUTTING IT ALL TOGETHER
Step by step:print'4A75737420616E6F74686572205065726C206861636B6572' =~s~.{2}~"qq(\\x{$&})"~regex;
WHY "regex" INSTEAD OF "geer"?1. Start with hex blob 2. Match every two characters 3. For each pair, build qq(\x{XX}) 4. First eval creates the qq() string 5. Second eval interprets the \x{} escape 6. r modifier returns the transformed string 7. print sends it to screen Output: Just another Perl hacker
The normal way to write this would be:
Same result. But where's the fun in that?s~.{2}~"qq(\\x{$&})"~geer
Spelling "regex" with the modifiers is the whole point. It's self-referential humor. The modifiers describe what they are. It's a JAPH - it's supposed to make you smile when you figure it out.
The x modifier does nothing useful here. It's just completing the word. That's the joke.
TRY IT YOURSELF
Save this as japh.pl and run it:
Or one-liner it:#!/usr/bin/perl print'4A75737420616E6F74686572205065726C206861636B6572' =~s~.{2}~"qq(\\x{$&})"~regex;
(shortened hex for readability - try the full blob yourself)perl -e 'print q{4A7573742061}=~s~.{2}~"qq(\\x{$&})"~regex'
Homework: encode your own
Want to make your own message? Here's how to get the hex:Then wrap it in the same pattern. Welcome to the club.perl -e 'print unpack("H*", "Your message here")'
_____ / \ | () () | \ ^ / ||||| ||||| "Now you know. And knowing is half the battle." - Some 80s cartoon, probably
Created By: Wildcard Wizard. Copyright 2026