in reply to The Lone Right Bracket

Well, it breaks because the /e modifier means, evaluate the right-hand side of this substitution as Perl code. And that's not valid Perl code. But you may have already known that.

Did you try running it through B::Deparse? This is what you get:

$words = 'This%is%Devious'; $words =~ s/%/do { () }/eg; $words =~ s/ /do { %} }\n/eg; print "$words\n";
Of course, this isn't valid code either, nor is the original with the ending curly brace. :) But apparently you're tricking the parser into recognizing it as valid. Very odd...

Some wonderful opportunities for obfuscation may lie down this path, it seems. :)