in reply to Hash Data Structure

I was going to comment on the for loops, but duff beat me too it. Isn't it a whole lot cleaner to deal with the array elements ... and to bypass that long namespace specifying name?

Less significant, but it will trim 10 lines from your program. Instead of declaring your variables one by one, if you make a list of them by wrapping them in parentheses, you can declare them all at once:

my ( $moduleName, $netName, @gateInst, $gate, $netCap, $violation, @maxTrans, $worstTrans, $line );

You never use $j, and you don't need $i any more. As for $moduleName, the first thing you do in the loop is assign a value, so you don't need to initialize it to an empty string.

The $drc::flag if/then/else section is a great situation for using references .... you do the exact same dereferencing, but a flag decides whether you access %drc::rpt1 or %drc::rpt1. How about:

my $rpt = $drc::flag ? \%drc::rpt1 : \%drc::rpt2; $rpt->{$moduleName}{$netName}{$gate}{"Capacitance"} = $violation;

Or maybe you could cause an error to assign the right object reference to a variable, instead of setting the flag?

If there's a possibility that the bodies of the loops will expand, it's worth keeping them explicit. But if they are defined as short one-liners, consider collapsing them:

if ( $drc::file1[$i] =~ m/^\s*\Module:/i ) { $moduleName = getModuleName ( $drc::file1[$i] ) ; } # could become $moduleName = getModuleName ( $item ) if ( $item =~ m/^\s*\Modul +e:/i );

I use a bit of space before the if() to emphasis what happens, and to separate the action and the condition.

This way, the subroutine becomes: For each element in the array, do A if appropriate, do B if appropriate, ,do C if appropriate, handle errors, .....

--
TTTATCGGTCGTTATATAGATGTTTGCA