C
Chris Weisiger
I apologize if this is the wrong place to post this; please let me know
the proper target if so.
I have a list of lists of numbers, and I want to sort the sublists.
Every variant on the syntax that I've tried either doesn't visibly do
anything to sort the lists, or else undefines them all. Here's what I
originally tried:
for (my $i = 0; $i < $numActors; ++$i)
{
for (my $j = 0; $j < $actors[$i]; ++$j)
{
$prolls[$i][$j] = int (rand(20) + 1);
} }
@prolls[$i] = sort {$a <=> $b} @prolls[$i];
} }
I suspect that I'm getting tripped up by how Perl handles lists of
lists and references and all that, but all the searching I've done
hasn't turned up anything that's worked. Any help would be appreciated.
For reference, I'm working on a dice rolling program for the Donjon
tabletop RPG. It's a great system, but it needs a lot of d20s...
the proper target if so.
I have a list of lists of numbers, and I want to sort the sublists.
Every variant on the syntax that I've tried either doesn't visibly do
anything to sort the lists, or else undefines them all. Here's what I
originally tried:
for (my $i = 0; $i < $numActors; ++$i)
{
for (my $j = 0; $j < $actors[$i]; ++$j)
{
$prolls[$i][$j] = int (rand(20) + 1);
} }
@prolls[$i] = sort {$a <=> $b} @prolls[$i];
} }
I suspect that I'm getting tripped up by how Perl handles lists of
lists and references and all that, but all the searching I've done
hasn't turned up anything that's worked. Any help would be appreciated.
For reference, I'm working on a dice rolling program for the Donjon
tabletop RPG. It's a great system, but it needs a lot of d20s...