in reply to Re: Transferring hash keys to array... Need help sorting
in thread Transferring hash keys to array... Need help sorting

So what you're suggesting is that the arrays are being sorted correctly, but just not aligned with one another? That makes sense so I could adjust accordingly per your advice here... See I thought the problem might have been that I wanted to sort the keys (labels) according to the integer following "label" and that because I was using character sorting that's why it wasn't working. Or is that not the case?
  • Comment on Re^2: Transferring hash keys to array... Need help sorting

Replies are listed 'Best First'.
Re^3: Transferring hash keys to array... Need help sorting
by huck (Prior) on Apr 21, 2017 at 03:47 UTC

    Well thats another kettle of fish. you want to sort by contents and leep labels in synced order. This will sort labels by the contents of $hash numerically <=>.

    my @labels=sort {$hash{$a}<=>$hash{$b}} keys %hash; my @content = @hash{@labels};