in reply to Transferring hash keys to array... Need help sorting
#!/usr/bin/perl # http://perlmonks.org/?node_id=1188504 use strict; use warnings; my %hash = qw( title1 1 title3 3 title4 4 title2 2 ); my @labels = sort keys %hash; my @content = @hash{@labels}; use Data::Dumper; print Dumper \%hash; print "\n"; print Dumper \@labels; print "\n"; print Dumper \@content;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Transferring hash keys to array... Need help sorting
by DARK SCIENTIST (Novice) on Apr 21, 2017 at 03:14 UTC | |
by tybalt89 (Monsignor) on Apr 21, 2017 at 03:30 UTC | |
by DARK SCIENTIST (Novice) on Apr 21, 2017 at 17:12 UTC | |
by AnomalousMonk (Archbishop) on Apr 21, 2017 at 03:30 UTC | |
by DARK SCIENTIST (Novice) on Apr 21, 2017 at 17:13 UTC |