... A 1 B 0 ...likewise bits upto 0 #### while($line=) { .... #reg bit field if($line=~/\/) { $bit_name=$1; ... print "Line no. where the bit field has been found : $.\n\n"; #As 'init_val' occurs on the second line after 'bit id' $line_count=$.+2; print "The incremented value is $line_count\n\n "; #reading the initial_value print "####################\n\n\n"; while($sub_line=) { print "**********************Entered the second loop******************\n\n\n"; print "The line no is $.\n\n"; if($.==$line_count) { if($sub_line=~/\(.*)\<\/INIT_VAL\>/) { $bits{"$bit_name"}=$1; print "...................The bit field initial value is $1......... \n\n" } if($sub_line=~/\/) { $bits{"$bit_name"}=0; print "The bit field initial value is 0\n\n\n " } } print "End of the Loop\n\n"; %bits=qw(0 0); } print "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n\n\n"; $.=$line_count; print "THE LINE COUNT IS $.\n\n "; } ... }