here's a chunk of code from public_pntf_summary.pl which is part of the Who's Online script..
i was interested in making it so the list of usernames shows up sorted by name instead of the random order it seems to be showing up in..
i'm a bit unfamiliar with Perl and was wondering how i'd take this list of User Numbers and convert it into a sorted list of User Names.
here's the block of code..
my @userstring;
my $counter = 0;
my @xa = @{ $r->{'sortorder'} };
my $diff = 0;
if($vars_pntf{CountOnly} eq "limit") {
if(scalar(@xa) > $vars_pntf{NameLimit}) {
$diff = scalar(@xa) - $vars_pntf{NameLimit};
@xa = @xa[0 .. ($vars_pntf{NameLimit} - 1)];
}
}
$r->{"overflow"} += $diff;
####### Here's where it takes the user number and adds it to the list to show in the Who's Online
SORTORDER: foreach my $number (@xa) {
my $pn = &GetPubName($number);
my $user_status = (&OpenProfile($number))[8];
next SORTORDER unless $pn;
push(@userstring, qq(
$wol_se_s$pn$wol_se_e));
}