%host_groups = get_host_groups(); foreach my $group (keys %host_groups) { print "$group = $group\t"; foreach (@{$host_groups{$group}}) { print "$host = $_\n"; } } sub get_host_groups() { .... while ($line = <FILE>) { .... $group_name = $hgn[2]; .... $hash{$group_name}= [@hosts]; .... .... } return (%hash); }
In reply to Is it right method to use Hash by amg
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |