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

Re: weird array processing question

by toolic (Bishop)
on May 05, 2011 at 21:03 UTC ( [id://903243]=note: print w/replies, xml ) Need Help??


in reply to weird array processing question

I don't know of an existing function, and my reduce-fu is weak. But, the 1st thing that comes to mind is a hash with grep:
use warnings; use strict; my %uniq; $uniq{$_}++ for (1 , 2, 3 , 4 , 1, 2, 3); my $matches = grep { $_ > 1 } values %uniq; die "Walrus Festival!" if $matches > 2;

Update: replaced keys with values

Log In?
Username:
Password:

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

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

    No recent polls found