in reply to Re^2: Array of Arrays on Monday.
in thread Array of Arrays on Monday.
If this means ignoring duplicates use a HashOfHashes (HOH)
poj#!perl use strict; use Data::Dumper; my %hash=(); while (<DATA>){ chomp; my ($name,$ip) = (split)[0,1]; if ( $name ne "" && $ip ne "" ) { ++$hash{$name}{$ip}; } } my %application=(); for my $name (keys %hash){ $application{$name} = [sort keys %{$hash{$name}}]; } print Dumper( \%application ) ; __DATA__ application1 10.10.1 application1 10.10.2 application3 10.10.1 application3 10.10.3 application2 10.10.3 application2 10.10.4 application2 10.10.5 application3 10.10.6 application1 10.10.1 application1 10.10.1
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Array of Arrays on Monday.
by vlturner (Sexton) on Jan 25, 2016 at 19:58 UTC | |
by poj (Abbot) on Jan 25, 2016 at 20:17 UTC | |
|
Re^4: Array of Arrays on Monday.
by vlturner (Sexton) on Jan 26, 2016 at 14:03 UTC | |
by poj (Abbot) on Jan 26, 2016 at 14:14 UTC |