Help for this page

Select Code to Download


  1. or download this
    my $max = 10;
    my @values = 1 .. $max;
    my @values_mixed = shuffle(@values);
    my @top = topNbsAB(5, sub { $a <=> $b }, \@values_mixed);
    print join(" ",sort { $a <=> $b } @top),"\n";
    
  2. or download this
    1 1 1 1 9
    
  3. or download this
        // Special case -- too few values provided. Just return them.
        if (len+1 <= n) {
    ...
           PUTBACK;
           XSRETURN(len+1);
        }