Help for this page

Select Code to Download


  1. or download this
    my %sortfkt = (
            "item"          => \&numerical,
    ...
            "age"           => \&numerical,
            "height"        => \&numerical,
            );
    
  2. or download this
    sub string {
        return $_[0] cmp $_[1];
    ...
    sub numerical {
        return $_[0] <=> $_[1];
    }
    
  3. or download this
    sort { &{$sortfkt{$orderby}}($hash{$a}{$orderby}, $hash{$b}{$orderby})
    + } keys %hash
    
  4. or download this
    #!/usr/bin/perl
    
    ...
    sub numerical {
        return $_[0] <=> $_[1];
    }