Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: scanning hash

by wfsp (Abbot)
on Aug 01, 2004 at 09:28 UTC ( [id://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!

Replies are listed 'Best First'.
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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://379041]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2024-04-19 19:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found