Obfuscated Perl Script #1

I love the Perl language. It can do so much with so little. Of course, that also means it can be a complete obfuscated nightmare.

Here is one example that I developed years ago when I was particularly bored. Maybe someday I'll explain what it is doing, how it is doing it, or why I decided to create it. Maybe.

Finding all Installed Perl Modules

There are a ton of Perl modules available. (See CPAN.) One problem that I've run into from time to time is determining whether I have a specific module installed or not. The most common approach I've used to determine this is the following command:

perl -Mmodule::name -e 1

If the command terminates correctly without errors, then the module is installed.

Remove several lines from a text file based on a match

Today at work, I was asked for a way to emulate the Unix command "grep -v", but remove multiple lines that follow a match instead of just the matched line. Apparently, it was something that would help in cleaning up some output my coworker was dealing with. There were no limits on what method or language I could use, so I obviously chose Perl :-).

Here is my solution: