Help for this page

Select Code to Download


  1. or download this
    my @array = (
        ["foo", 1],
    ...
    my $idx = 0;
    $idx++ while ( $v > $array[$idx][2] );
    print $array[$idx][0],"\n";
    
  2. or download this
    my @list = map { ($_->[0]) x $_->[1]  } @array;
    my $elem = $list[rand @list];