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

using pseudo-hashes for unique lists (was Re: Re: Return a Unique Array)

by particle (Vicar)
on Feb 11, 2002 at 17:07 UTC ( [id://144651]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my @non_unique = qw/carpet car pet/; # fails on 'car' and 'pet'
    my @non_unique = ("bob and sue","bob"); # fails on space seperated wor
    +ds
    
  2. or download this
    #!/usr/local/bin/perl -w
    use strict;
    ...
    $^ = "SortedWordsAndCountHeader";
    $~ = "SortedWordsAndCount";
    write for @unique;
    
  3. or download this
    Words               Count
    bob and sue             1
    ...
    carpet                  2
    bob                     1
    car                     1
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (4)
As of 2024-04-24 07:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found