#!/usr/bin/perl -w use CGI::Carp qw(fatalsToBrowser); use CGI; my $req = new CGI; my $sort = $req->param("sort"); if(!$sort){ $sort = "id";} print "Content-type: text/html\n\n"; print "Click on a header to sort.
"; print "\n\n\n\n\n\n\n\n"; opendir(DIR, "members"); my @files = grep( /\.dat/, readdir(DIR) ); @files = sort(@files); closedir(DIR); $num = 0; foreach $file(@files){ open (TXTFILE, "members/$file") or die "Can't open $file"; @lines = ; close(TXTFILE); tr/\r\n//d for @lines; $hit = $lines[0]; if($hit >0){ $info = sprintf("%.2f", ($lines[1]/$hit) ); $graphics = sprintf("%.2f", ($lines[2]/$hit) ); $friendly = sprintf("%.2f", ($lines[3]/$hit) ); $techno = sprintf("%.2f", ($lines[4]/$hit) ); $entertain = sprintf("%.2f", ($lines[5]/$hit) ); $rate = sprintf("%.2f", (($info + $graphics + $friendly + $techno + $entertain)/5) ); $id = $file; $id =~ s/\.dat//; $all_hashes[$num] = ({ ID => $id, info => $info, graphics => $graphics, friendly => $friendly, techno => $techno, entertain => $entertain, rate => $rate, hit => $hit, }); }#end if hit $num++; }#end for each file if($sort eq "id" ){ @all_hashes = sort { $a->{ID} <=> $b->{ID} } @all_hashes;} if($sort eq "info" ){ @all_hashes = sort { $a->{info} <=> $b->{info} } @all_hashes;} if($sort eq "graphics" ){ @all_hashes = sort { $a->{graphics} <=> $b->{graphics} } @all_hashes;} if($sort eq "friendly" ){ @all_hashes = sort { $a->{friendly} <=> $b->{friendly} } @all_hashes;} if($sort eq "techno" ){ @all_hashes = sort { $a->{techno} <=> $b->{techno} } @all_hashes;} if($sort eq "entertain" ){ @all_hashes = sort { $a->{entertain} <=> $b->{entertain} } @all_hashes;} if($sort eq "average" ){ @all_hashes = sort { $a->{rate} <=> $b->{rate} } @all_hashes;} if($sort eq "hits" ){ @all_hashes = sort { $a->{hit} <=> $b->{hit} } @all_hashes;} for(@all_hashes){ print "\n\n\n\n\n\n\n\n"; } print "
IDInfoGraphicsFriendlyTechnoEntertainAverageHits
$_->{ID}$_->{info}$_->{graphics}$_->{friendly}$_->{techno}$_->{entertain}$_->{rate}$_->{hit}
"; #### Click on a header to sort. ID Info Graphics Friendly Techno Entertain Average Hits Content-type: text/html Software error: Modification of a read-only value attempted at line 50. For help, please send mail to the webmaster (support@aplus.net), giving this error message and the time and date of the error. #### if($sort eq "id" ){ @all_hashes = sort { $a->{ID} <=> $b->{ID} } @all_hashes;}