in reply to While issues

Your problem is here:

my $xda = int rand (0 .. $total);

rand only takes a single parameter, so you're selecting a random number from 0 to 0 currently. This is probably what you intended:

my $xda = int rand $total;

-Miller

Replies are listed 'Best First'.
Re^2: While issues
by ikegami (Patriarch) on Feb 03, 2011 at 16:01 UTC
    Off by one. That will never return $total. rand returns a value that's "up to but not including" its argument.