rheaton has asked for the wisdom of the Perl Monks concerning the following question:
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);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Adding Array References to an Array
by jasonk (Parson) on Dec 28, 2006 at 19:47 UTC | |
by pKai (Priest) on Dec 29, 2006 at 09:05 UTC | |
|
Re: Adding Array References to an Array
by swampyankee (Parson) on Dec 28, 2006 at 19:34 UTC | |
by chromatic (Archbishop) on Dec 29, 2006 at 00:39 UTC |