Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: How to find number of unique elemenst in array

by oko1 (Deacon)
on Nov 27, 2008 at 21:24 UTC ( [id://726488]=note: print w/replies, xml ) Need Help??


in reply to How to find number of unique elemenst in array

The solution offered by ikegami is really the Right Thing here, but - just to be silly -

#!/usr/bin/perl -wl use strict; my @a; $a[ord($_)-65]++ for <DATA>; print "There are $a[$_] element(s) of ", chr($_+65) for 0..$#a; __DATA__ A B C D A B A C A D

--
"Language shapes the way we think, and determines what we can think about."
-- B. L. Whorf

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2024-03-29 00:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found