Basically, I have a set of scores that will be pushed into an array each time the program loops (i.e. the person says they want to play again) This is my code so far:
print "Your final score is: $score_total\n\n"; # score organiser. print "Please enter your initials for the high score table: \n"; chomp (my $initial_add = <STDIN>); my @initials_array = (); push (@initials_array, $initial_add); my @score_array = ($score_total); push (@score_array, $score_total); print "Name = $initials_array[0]\tScore = $score_array[0]\n"; print "Initials \t Score \n";
It is worth noting that the variable $score_total is the score from an earlier bit of code, every time this bit finishes and the $score_total is pushed into @score_array, the $score_total gets intialized to 0 again so a new score can be added. How can I go about putting this in a high scores table that is displayed as the above code part : print "Name = $initials_array[0]\tScore = $score_array[0]\n"; I want it to add the scores each time the game is played so that the high scores table gets more populated. THANKS IF ANYONE CAN HELP!!

In reply to Making a dynamic high scores table by chickenlips

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.