After much searching and testing, found the answer at perlmonks.com. The second routine now has this:
#-----------------------------
my @data;
my %seen;
my $path = "/big/dom/xvmcoc/www/members";
open (DB, "<$path/birthday_list.txt") or &cgierr ("Unable to open output database.\nReason: $!"); open (DBBDAY, ">$path/birthday_list_2.txt") or &cgierr ("Unable to open output database.\nReason: $!");
@text = <DB>;
close (DB);
my @sorted = map { $_->[0] }
sort { $a->[0] <=> $b->[0] ||
$a->[1] <=> $b->[1];
}
map { [ $_, join "", reverse (split /-/) ] }
@text;
foreach $line(@sorted) {
$line =~ s/\*//g;
$line =~ s/\|/ /g;
print DBBDAY "$line";
}
close DBBDAY;
}
Which produces this:
1-1 Julie Wakefield
1-3 Sarah Nichols
1-6 Kaleb Brown
1-7 Thelma Cole
1-7 Lorraine Brock
1-7 Jane Rollins
Leonard
aka PerlFlunkie
Code:
sub build_birthday_list_2 { #-----------------------------
my @data;
my %seen;
my $path = "/big/dom/xvmcoc/www/members";
open (DB, "<$path/birthday_list.txt") or &cgierr ("Unable to open output database.\nReason: $!"); open (DBBDAY, ">$path/birthday_list_2.txt") or &cgierr ("Unable to open output database.\nReason: $!");
@text = <DB>;
close (DB);
my @sorted = map { $_->[0] }
sort { $a->[0] <=> $b->[0] ||
$a->[1] <=> $b->[1];
}
map { [ $_, join "", reverse (split /-/) ] }
@text;
foreach $line(@sorted) {
$line =~ s/\*//g;
$line =~ s/\|/ /g;
print DBBDAY "$line";
}
close DBBDAY;
}
Which produces this:
Quote:
1-1 Julie Wakefield
1-3 Sarah Nichols
1-6 Kaleb Brown
1-7 Thelma Cole
1-7 Lorraine Brock
1-7 Jane Rollins
Leonard
aka PerlFlunkie