Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
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 cooling their heels in the Monastery: (7)
As of 2014-09-19 10:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (134 votes), past polls