CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner:
sorting variables



Aug 13, 2000, 9:45 AM

Post #1 of 1 (1184 views)
sorting variables Can't Post

I am trying to make a 'best guessers' script
here is the routine i have so far:

open ("USERNAMES", "users.list");
@username = <USERNAMES>;
foreach (@username) {
($user) = split ('[|]',$_);
open ("FILE","/data/$user.reg")&#0124; &#0124;print "cant read userfile";
@file = <FILE>;
foreach (@file) {
( $name, $xguess, $xright, $xscore) = split ('[|]',$_);

close (FILE);
close (USERNAMES);

First I would like to sort by $xright (the variable that indicates how many correct guesses the user has
if there is a tie then sort those by $xscore (the score for the correct answers)
finally if there is still a tie I want to sort by $xguess (number of guesses it took to get the score) on $xguess the lower number is better.

BTW, thanks for all the help ive needed the last month, everyone has been super-helpful.


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives