open (NETSTATS,"$input_file"); $/ = "\nnet '"; my @field_names = ( 'wire capacitance', 'wire resistance', 'number of loads', 'number of pins', 'total wire length' ); while () { chomp; # removes $/ from end of string; warn "got record # $.\n" if ( $. % 50000 == 0 ); # this belongs on STDERR, IMO next unless (/^([^']+)'/); $NetName = $1; my %field_val = (); for my $field ( @field_names ) { if ( /$field:\s+([\d.]+)/ ) { $field_val{$field} = $1; } } # .... }