#!/usr/bin/perl use warnings; use strict; use Data::Dumper; my %struct = ( User => [qw[ Forename Surename ]], Residence => [qw[ Street State ]], ); sub GroupResults{ my ($AllRecords) = @_; my %grouped; for my $info (keys %struct) { $grouped{$info}{$_} = $AllRecords->{$_} for @{ $struct{$info} +}; } warn Dumper(\%grouped); return \%grouped } my $hash_of_excel = [ { Street => 'NuN', ID => '232', State => 'KKDI', Forename => 'alex', Surname => 'davis', }, { Street => 'NuN', ID => '25452', State => 'TRY', Forename => 'George', Surname => 'Daniel', }, { Street => 'NuN', ID => '74545', State => 'MDU', Forename => 'Mark', Surname => 'Davies', }, ]; for my $results (@$hash_of_excel) { my $specificresults = GroupResults($results); }
In reply to Re: group certain columns in a hash
by choroba
in thread group certain columns in a hash
by spie287
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |