#!/usr/bin/perl

$dpkg_output = `export COLUMNS=250;dpkg -l | grep $ARGV[0]`;

while($dpkg_output =~ m/(?:[ir]i|pc)[ ]*([a-zA-Z0-9-.+]+)[ ]*.*/g){
	print "Attempting to remove ".$1."\n";
	`apt-get remove -y -f $1`;
}
