Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: scanning hash

by wfsp (Abbot)
on Aug 01, 2004 at 09:28 UTC ( #379041=note: print w/ replies, xml ) Need Help??


in reply to scanning hash

#!/bin/perl5 use strict; use warnings; my %hash = ( key1 => 0, key2 => 0, key3 => 0); my %dups = reverse %hash; my $count = keys %dups; print "$count\n";
$count = 1

Beaten to the post of course. This is just in case you wanted to do it on two lines instead of one!


Comment on Re: scanning hash
Download Code
Re^2: scanning hash
by Aristotle (Chancellor) on Aug 01, 2004 at 14:41 UTC
    Again, incorrect, like Re: scanning hash. This approach treats undefs and empty strings as the same.

    Makeshifts last the longest.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (10)
As of 2015-07-04 11:36 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 (59 votes), past polls