in reply to quandery about a grep statement

Assuming you mean sorting normally:
sub beautify { my %stuff; @stuff{@_} = undef; return sort keys %stuff; }
so that:
print join ' ',beautify(qw(h e l l o w o r l d)); # prints "d e h l o +r w" print join ' ',beautify(qw(b u m b l e b e e)); # prints "b e l m u"
If you want it sorted by frequency increasing:
sub beautify { my %stuff; $stuff{$_}++ for(@_); return sort { $stuff{$a} <=> $stuff{$b} } keys %stuff; }
so that:
print join ' ',beautify(qw(h e l l o w o r l d)); # prints "e w r h d +o l" print join ' ',beautify(qw(b u m b l e b e e)); # prints "m u l e b"
You can, of course, reverse the result if you want it highest-frequency-first.

Hope this helps.

Update: Rrgh -- someone else always posts first while I'm typing my reply...