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

... what if the content for each element of that array is a string of characters and not numeric?

One interpretation:

c:\@Work\Perl\monks>perl -wMstrict -le "use Data::Dump qw(dd); ;; my %hash = qw(title1 uno title3 tres title4 quatro title2 dos); ;; my @labels = sort keys %hash; my @content = @hash{@labels}; ;; dd \%hash; dd \@labels; dd \@content; " { title1 => "uno", title2 => "dos", title3 => "tres", title4 => "quatr +o" } ["title1", "title2", "title3", "title4"] ["uno", "dos", "tres", "quatro"]
(BTW: This is something you could actually have tried for yourself!)

Update: The  @hash{@labels} thing is a hash slice.


Give a man a fish:  <%-{-{-{-<

Replies are listed 'Best First'.
Re^4: Transferring hash keys to array... Need help sorting
by DARK SCIENTIST (Novice) on Apr 21, 2017 at 17:13 UTC
    Hash slices are a new concept for me but I will give this a try as well as the other suggestions everyone has added here