#!/usr/intel/bin/perl use warnings; use strict; my $find_flag; #using a flag variable while ( <> ){ if (/^\S/){ #match a line that start with no space if (/^\w+clk\[\d+\]/){ #match requested headline $find_flag = 0; } else{ $find_flag = 1; } } next if $find_flag and /\s+QUALIFIED_CLOCK/; #skips the line requested print qq{$_}; #printing ordinary line }