in reply to creating an array name using information from another array
my %xref_hash; for my $dev ( @dev_list ) { print STDOUT "looking for $dev\n"; for my $x ( @xref ) { if ( $x =~ /$dev\./i ) { my $hkey = "dev_xref_$dev"; push @{ $xref_hash{ $hkey }}, $x; } } } # to use that data structure: for my $hkey ( keys %xref_hash ) # (you might want to sort) { print join( "\n ", "\nvalues for $hkey:", @{$xref_hash{$hkey}} ), +"\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: creating an array name using information from another array
by Balls McWang (Novice) on Mar 05, 2004 at 15:02 UTC |