is valid under strict but unlikely to do anything usefull. You get the hash flattened into a list, the list get's sorted, and then assigned to hash. A list assigned to a hash uses consecutive pairs and key/value pairs. I wrote a quick bit of code.%hash = sort %hash;
Output isuse strict; use warnings; my %hash = ( thing1 => 'one thing', thing2 => 'leads to another', All => 'is great and glorious', ); print "$_ => $hash{$_}\n" for keys %hash; %hash = sort %hash; print "\n"; print "$_ => $hash{$_}\n" for keys %hash;
I can't think of a reason you would want to do this. I just wanted to throw it into this thread since it is kinda (but not really) used in the initial code.thing2 => leads to another All => is great and glorious thing1 => one thing leads to another => one thing thing1 => thing2 All => is great and glorious
Goip,
Ira,
"So... What do all these little arrows mean?"
~unknown
In reply to Re: two questions that come together into one grand unified question
by IraTarball
in thread sorting and comparing hashes
by ashaman
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |