Looks like you need a hash of hashes instead. Something like this (untested):
You can use an array for the top level instead, and have an array of hashes. But if you have duplicate aliases, you'll want the hashes at the second level.my %master; while (<>) { my @line = split ' '; foreach my $alias ( @line[1..$#line] ) { $master{$line[0]}{$alias}++; } } foreach my $ip ( sort keys %master ) { print "$ip ", +join( ' ', sort keys %{$master{$ip}}), "\n"; }
-QM
--
Quantum Mechanics: The dreams stuff is made of
In reply to Re: Perl and arrays of arrays?
by QM
in thread Perl and arrays of arrays?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |