@NumberToName = ("zero","one","two","three","four","five"); $rh = random(1,5,1); # ratio count of urban mosquitoes do { $rf = random(1,5,1); } until ($rf != $rh); # ratio count of forest mosquitoes $rht = $NumberToName[$rh]; $rft = $NumberToName[$rf];There is certainly no need to recreate the hash for each of the two variables, and certainly no need to do it inside the do-until loop. There's really no need to a hash at all, as an array does just fine for this (since your hash keys are just small integers).
Re: Is it possible to pair text and numeric values in hash arrays?
by Davide Cervone - Number of replies: 0
I'm not sure why you don't just do something like this: