in reply to Re: Clearing a hash/array
in thread Clearing a hash/array
That is just a part of it, I think the rest isn't important. My objective is to populate the Master array, print it, and make changes to the hlist and then populate the new array with the changes in the hlist. Currently the array prints the info out the first time, but is empty if printed a second time Thanks# Traverse the tree and create a data array of unique elements my $lastline; while($HList->info('exists', $Topology)) { $_ = $HList->info('next', $Topology); $Topology = $_; unless (/^$lastline/) { push (@data, $lastline); } $lastline = $_; } # Seperate the child from the parent (leaf from the tree) my $cnt = 0; foreach $_ (@data) { if ($_ =~ /\//) { $check = $_; ($parent, $child) = $check =~ m/(.*\/)(.*)$/; # Only take the unique parents push (@master, $parent) unless ($seen{$parent}++); $child = join("", $child, "\=[Unique $cnt]"); $cnt ++; push (@master, $child) unless ($seen{$child}++); } } print "MASTER: @master\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Clearing a hash/array
by hossman (Prior) on Mar 08, 2002 at 23:41 UTC |