Width = 32 Descr - "This is Register1 comment" # f_name bit_pos RESERVED 31:8 RXDATA 5:0 #### if($line =~ m/^Width[\s]*\=[\s]*\d+$/) # to match Width { update_curs ($line); } elsif ($line =~ m/^Descr[\s]*-[\s]*[\w]+$/) # to match Descr { update_curs ($line); } else { printf "Garbage found: \"%s\" \n",$line; } #### sub validate_save_regs { my $line = $_; chomp $line; if($line =~ m/^Width[\s]*\=[\s]*\d+$/){ $reg_width_found = 1; update_curs ($line); } elsif ($line =~ m/^Descr[\s]*-[\s]*[\w]+$/) { printf "inside elsif, line is %s\n",$line; if(!$reg_offset_found) { printf "Garbage found at: %d \n", $line_no; exit(0); } $name_found = 1; update_curs ($line); } else { printf "Garbage found %s\n", $line; } }