in reply to Re^2: Search and replacein thread Search and replace
$line =~ s/input(?= .*clk)/output/g; [download]
Untested since no test cases were provided.