M
monte
I am a new user and I am parsing and file that contains a heirarchy. i
would like to get the cell name once and the libraries that that the
cell was found. my code is repeating he output everytime it goes into
and produces multiple listing of the cell when I only like to have this
done once. Can anyone help me figure this out?
1)suppose the input file is formatted like this
1. libA cellB
2. libC cellD
....
8. libF cellG
9. libX cellB
2) desire output:
CELL:cellB LIB:libA libX
CELL:cellD LIB: libC
CELL:cellG LIB: libF
4) my code:
while(<>)
{
chomp;
$show_file=$_;
next if ( $show_file=~ /\#/ );
#print $show_file;
$show_file=~/^\s+\d\.\s+(\S+)\s+(\S+)/;
$lib=$1;
$cell=$2;
#checking if the same cell exist in the same heirarchy
($rec{$2}= "Cell:$2 Lib:") if (! exists($rec{$2}));
$rec{$2}.="$1\t";
foreach $entry(keys %rec)
{
print" $rec{$entry}\n";
}}#last braket for 1st foreach loop
5) My output list the cells and libs everytime it goes into the loop
and I only like to have the cell listed once with the libraries
associated with it.
would like to get the cell name once and the libraries that that the
cell was found. my code is repeating he output everytime it goes into
and produces multiple listing of the cell when I only like to have this
done once. Can anyone help me figure this out?
1)suppose the input file is formatted like this
1. libA cellB
2. libC cellD
....
8. libF cellG
9. libX cellB
2) desire output:
CELL:cellB LIB:libA libX
CELL:cellD LIB: libC
CELL:cellG LIB: libF
4) my code:
while(<>)
{
chomp;
$show_file=$_;
next if ( $show_file=~ /\#/ );
#print $show_file;
$show_file=~/^\s+\d\.\s+(\S+)\s+(\S+)/;
$lib=$1;
$cell=$2;
#checking if the same cell exist in the same heirarchy
($rec{$2}= "Cell:$2 Lib:") if (! exists($rec{$2}));
$rec{$2}.="$1\t";
foreach $entry(keys %rec)
{
print" $rec{$entry}\n";
}}#last braket for 1st foreach loop
5) My output list the cells and libs everytime it goes into the loop
and I only like to have the cell listed once with the libraries
associated with it.