Perl

Solaris zone processes

A recent quetion I was asked: When listing processes on a system using Solaris zones, is it possible to see the user names instead of the user IDs for processes running in the zone?

Short answer: Not directly. Indirectly, yes.

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: