#!/usr/bin/perl use strict; use Mail::POP3Client; my %accounts = ( USER => "simon", AUTH_MODE => "PASS", PASSWORD => "MYPASS", HOST => "pop3.myhost.net" # Other accounts here ); my $whence = shift; my @which = @ARGV; my $x; die unless $x = $accounts{$whence}; my $pop = new Mail::POP3Client (%$x); unless ($pop) { warn "Couldn't connect\n"; next; } my $y = $pop->Count; if ($y<0) { die "Authorization denied" } for (@which) { print "Purging $_\n"; $pop->Delete($_); } $pop->Close;