Re: Display a hash in the order of an array

2015-07-17 Thread Charles DeRykus
Another approach using Tie::IxHash: use Tie::IxHash; use Data::Dumper; use feature 'say'; my @ip = (...) my %hash = (...); tie( my %ordered, 'Tie::IxHash', map { ( $_,[ ] ) } @ip ); while ( my($key,$value) = each %hash ) { push @{$ordered{$value->{ip}}}, {$key,$value}; } say Dumper \%orde

Re: Display a hash in the order of an array

2015-07-17 Thread Brandon McCaig
On Fri, Jul 17, 2015 at 10:40 AM, Brandon McCaig wrote: > for my $i (0..4) { Errr, 0..3. >_> Regards, -- Brandon McCaig Castopulence Software Blog perl -E '$_=q{V zrna gur orfg jvgu jung V fnl. }. q{Vg qbrfa'\''g nyjnlf fbhaq gung

Re: Display a hash in the order of an array

2015-07-17 Thread Brandon McCaig
Vincent: On Fri, Jul 17, 2015 at 9:11 AM, Vincent Lequertier wrote: > Hi, Hello, > I have the following structure : > > $hash{$date} = { > 'ip' => $ip, > 'action' => $action, > }; > > witch produce data like : > > $VAR1 = '[15/Jul/20

Re: Display a hash in the order of an array

2015-07-17 Thread Shawn H Corey
On Fri, 17 Jul 2015 15:11:13 +0200 Vincent Lequertier wrote: > Hi, > > I have the following structure : > > $hash{$date} = { > 'ip' => $ip, > 'action' => $action, > }; > > witch produce data like : > > $VAR1 = '[15/Jul/2015:10:3

Display a hash in the order of an array

2015-07-17 Thread Vincent Lequertier
Hi, I have the following structure : $hash{$date} = { 'ip' => $ip, 'action' => $action, }; witch produce data like : $VAR1 = '[15/Jul/2015:10:30:03 +0200]'; $VAR2 = { 'ip' => 'xxx.xxx.xxx.xxx', 'action' => 'G