Removing a Perl module

Save this script as perlmodremove:

#!/usr/bin/perl -w 

use ExtUtils::Packlist;
use ExtUtils::Installed; 

$ARGV[0] or die "Usage: $0 Module::Namen"; 

my $mod = $ARGV[0]; 

my $inst = ExtUtils::Installed->new(); 

    foreach my $item (sort($inst->files($mod))) {
             print "removing $itemn";
             unlink $item;
          } 

     my $packfile = $inst->packlist($mod)->packlist_file();
          print "removing $packfilen";
          unlink $packfile;

Give execute rights and call the script with the module you want to remove;

chmod +x perlmodremove
perlmodremove Mail::IMAPClient