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; }