in reply to problems with Mail::AddressSort
Did you know that when you do while (<EMAILS>) you actually shift the first element out and place it in $_? that's how you actually get out of the while loop when you're out of elements.
that's why you are loosing the first element of the list. so your while loop is actually doing nothing but take blah@aol.com out.
this is probably what you wanted to say:#!/usr/bin/perl -w use strict; use Mail::AddressSort; open(EMAILS, "/root/emails") or die "Couldn't open email list\n"; my @addresses = <EMAILS>; if (@addresses) { my $list=Mail::AddressSort->new(); $list->input(@addresses); (@addresses)=$list->sorted(); print join "\n", @addresses; }
|
|---|