Help for this page

Select Code to Download


  1. or download this
    my $first = 1;
    for my $n (sort { $hash{$a} <=> $hash{$b} } keys %hash){
    ...
    
       ...
    }
    
  2. or download this
    my @names_by_val = sort { $hash{$a} <=> $hash{$b} } keys %hash;
    shift(@names_by_val);
    for my $n (@names_by_val) {
       ...
    }
    
  3. or download this
    my @names_by_val = sort { $hash{$a} <=> $hash{$b} } keys %hash;
    for my $n (@names_by_val[1..$#names]) {
       ...
    }
    
  4. or download this
    my %hash;
    foreach my $n (@names){
    ...
        $hash{$n}=$r;
    }
    my @names_by_val = sort { $hash{$a} <=> $hash{$b} } keys %hash;
    
  5. or download this
    use List::Util qw( shuffle );
    my @shuffled_names = shuffle @names;