Acme-Glue
view release on metacpan or search on metacpan
# SNIPPETS
Here are the snippets that may accompany the photo project
## LEEJO (transform.pl)
#!/usr/bin/env perl
#
# transform an array of hashes into an array of arrays where each array
# contains the values from the hash sorted by the original hash keys or
# the passed order of columns (hash slicing)
my @ordered = $column_order
? map { [ @$_{ @{ $column_order } } ] } @{ $chaos }
: map { [ @$_{sort keys %$_} ] } @{ $chaos };
## LEEJO (hopscotch.p6)
#!/usr/bin/env perl6
my @court = (
lib/Acme/Glue.pm view on Meta::CPAN
=head1 SNIPPETS
Here are the snippets that may accompany the photo project
=head2 LEEJO (transform.pl)
#!/usr/bin/env perl
#
# transform an array of hashes into an array of arrays where each array
# contains the values from the hash sorted by the original hash keys or
# the passed order of columns (hash slicing)
my @ordered = $column_order
? map { [ @$_{ @{ $column_order } } ] } @{ $chaos }
: map { [ @$_{sort keys %$_} ] } @{ $chaos };
=head2 LEEJO (hopscotch.p6)
#!/usr/bin/env perl6
my @court = (
snippets/LEEJO/transform.pl view on Meta::CPAN
my $required_order = [ @ARGV ];
my $chaos = [
{
1 => 'Liz',
2 => 'Nat',
3 => 'Lee',
},
];
# transform an array of hashes into an array of arrays where each array
# contains the values from the hash sorted by the original hash keys or
# the passed order of columns (hash slicing)
my @ordered = @{ $required_order // [] }
? map { [ @$_{ @{ $required_order } } ] } @{ $chaos }
: map { [ @$_{sort keys %$_} ] } @{ $chaos };
say join( ",",map { @{ $_ } } @ordered );
( run in 1.559 second using v1.01-cache-2.11-cpan-f985c23238c )