Help for this page

Select Code to Download


  1. or download this
    # indexed array
    @array = sort { (-1,1)[int rand 2] } @array;
    ...
    # or trinary alternative
    @array = sort { int rand 2 ? 1 : -1 } @array;
    
  2. or download this
    #!/usr/bin/perl -w
    
    ...
        print $fruit , map { $result{ $fruit , $_ } } (0..$#array);
        
    }
    
  3. or download this
            0     1     2     3     4     5
    peach   2982  3026  2010  1095  573   314
    ...
    orange  1156  1116  1914  2558  1999  1257
    apple   602   561   1162  2030  3171  2474
    cherry  303   320   621   1279  2555  4922