SPUG: Sorting the contents of a scalar?

John W. Krahn krahnj at telus.net
Mon Feb 26 17:20:34 PST 2007

Atom Powers wrote:
> This seems like it should be so easy; but I can't find anything that
> would tell me why this doesn't work or how to do it correctly.
> sort( qw/$hash{$value}/ )
> Where $hash{$value} is something like "mary jane joe bob".
> Any ideas?

my @sorted = sort split ' ', $hash{ $value };

Perl isn't a toolbox, but a small machine shop where you can special-order
certain sorts of tools at low cost and in short order.       -- Larry Wall

More information about the spug-list mailing list