|
|
| Perl Monk, Perl Meditation | |
| PerlMonks |
Re: Making a dynamic high scores tableby roboticus (Canon) |
| on Dec 01, 2012 at 17:20 UTC ( #1006617=note: print w/ replies, xml ) | Need Help?? |
|
I'd suggest storing the high score list in a file so that when you restart the game, you still have the original values. So your subroutine to save & display high scores might be something like:
Optionally, if you want to keep only the top X scores, then after sorting, just write the first X items back to the new file. Also, to prevent a program problem from causing you to lose the entire list, write the new list to a different file. Once you're done, then you can rename the original to original.bak, and then rename the new file to the original name. ...roboticus When your only tool is a hammer, all problems look like your thumb.
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||