in reply to creating an array name using information from another array
Hi,
I'm not sure what the point of the lines scalar(@dev_list) == $#dev_list + 1; scalar(@xref) == $#xref + 1; is since == is an equality test - are these lines supposed to be comments for you?
A more perlish way to write your nested for loops would be:
for my $devitem (@dev_list) { print "Looking for $devitem\n"; for my $xrefitem (@xref) { if ($xrefitem =~ /$devitem/i) { #Do you really need to match a +nother character? #What's the next line for? # $templine=join "_","\@dev_xref",$dev_list[$i]; my @{$templine}[0]=$xrefitem; } }
I'm not entirely sure that I understood what you were trying to do but you can create variables named using the contrents of another variable using the ${$varname} style syntax. But then you have to store your created variable's name so you can access it later... it might be easier to pre-dclare a hash and use the keys function.
HTH - Mark
|
|---|