Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

The Uniqueness of hashes.

by injunjoel (Priest)
on Sep 25, 2005 at 02:37 UTC ( #494836=perlmeditation: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    perl, v5.8.0 built for MSWin32-x86-multi-thread
    
  2. or download this
    #!/usr/bin/perl
     
    ...
        print "\n";
    }
    
  3. or download this
    
    my @array1 = (1 .. 20);
    ...
    '21','22','23','24','25','26','27','28','29','30',
    '31','32','33','34','35','36','37','38','39','40']
    
  4. or download this
    
    my %unique_sets;
    ...
      '40' => [40]
    }
    
  5. or download this
    
    my %unique_counts = do{ 
    ...
      '40' => 1
    }
    
  6. or download this
    
    my %duplicates = do{
    ...
      '29' => 2,
      '30' => 2
    }
    
  7. or download this
    
    my %non_duplicates = do{
    ...
      '40' => 1
    }
    
  8. or download this
    
    my %unique_descriptive = do {
    ...
    }
    
    
  9. or download this
    
    my %max = do{
    ...
      'count' => 3,
      'values' => [20,20,20]
    }
    
  10. or download this
    
    my %min = do{
    ...
      'count' => 1,
      'values' => [40]
    }
    
  11. or download this
        shift @{[ 
            map{$_->[2]} 
            sort{$a->[0] <=> $b->[0] || $a->[1] <=> $b->[1]} 
            map{[$_{$_}->{count}, $_, $_{$_}]} keys %_ 
            ]}
    
  12. or download this
    ... = do {
            local %_ = %unique_descriptive;
    ...
                sort{ $_{$a}->{count} <=> $_{$b}->{count} || $b <=> $a} ke
    +ys %_ 
            ]}}};
    };
    
  13. or download this
    #!/usr/bin/perl -w
    use strict;
    ...
    print OUTPUT, $d{$_}."\n" for(sort keys %d);
    close OUTPUT;
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://494836]
Approved by planetscape
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (17)
As of 2015-07-30 15:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (272 votes), past polls