Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^5: To Hash or to Array--Uniqueness is the question.

by Nkuvu (Priest)
on Dec 02, 2005 at 17:48 UTC ( #513664=note: print w/ replies, xml ) Need Help??


in reply to Re^4: To Hash or to Array--Uniqueness is the question.
in thread To Hash or to Array--Uniqueness is the question.

Bah, this is what I get for being lazy. ;)

Instead of creating a file so that I could open it via the $fh filehandle, I used the following snippet:

# sort method my @values = qw( one foo bar one baz two quack baz ); my %h = (); foreach (@values) { $h{ $_ } ||= $.; } print "\n\nSort method:\n"; print (join ", ", sort { $h{a} cmp $h{b} } keys %h);

And totally missed the fact that Moron was using $. as the hash value. Thanks for pointing out what I should have already noticed.


Comment on Re^5: To Hash or to Array--Uniqueness is the question.
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (20)
As of 2014-07-29 17:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (225 votes), past polls