# Early in the code, i.e. in some configuration section my @max_damages = (0) x $number_of_rooms; @max_damages[ 1, 2, 3, 6 ] = ( 2, 3, 4, 5 ); # ... then $wizard -= 1 + int(rand($max_damages[$room]));