# 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";