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.