This question is a spin off of that was found in the last question I posted.
target_list is a hash I am using to determine my Unique Targets. If there is a better way of doing this please tell me. What am I doing wrong so that the only element that seems to be added to the @target_file array is the last element processed. The new pushs to the array are not adding the new @tfl_contents reference. Thanks again.
open(tfl_file, $target_file_layout) || die "Unable to open target +file layout metadata file $target_file_layout: $!\n"; foreach (<tfl_file>) { if($_ =~ /$ARGV[0]/){ chomp $_; @tfl_contents = split(/\&/, $_); if ($tfl_contents[9] ne ""){ $target_list{$tfl_contents[9]}++; push(@target_file, \@tfl_contents); } if ($debug eq "Y") { print "Source Found in Metadata: $_\n"; print "Contents Array = @tfl_contents\n"; print "Contents Ref = @$tfl_ref\n"; print "Element = $tfl_ref->[1]\n\n"; } } else{ #Do Nothing } } print Dumper(\@target_file); sleep; @tfl_list = keys %target_list; if ($debug eq "Y") { print "TARGET_LIST = @tfl_list\n"; } close(tfl_file);
In reply to Adding Array References to an Array by rheaton
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |