Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Making a dynamic high scores table

by Athanasius (Monsignor)
on Dec 01, 2012 at 16:14 UTC ( #1006612=note: print w/ replies, xml ) Need Help??


in reply to Making a dynamic high scores table

When you declare a variable with my, you initialise it. If you do this inside a loop, the variable is re-initialised on each loop iteration. But if you want the variable to grow as the loop iterates, you need to declare it once only, before the loop:

my @initials; my @scores; while (...) # The major loop { ... push @initials, $initial_add; push @scores, $score_total; ... } # access @initials and @scores here

Hope that helps,

Athanasius <°(((><contra mundum


Comment on Re: Making a dynamic high scores table
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1006612]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2014-10-23 05:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (124 votes), past polls