in reply to Re^2: Search and replace
in thread Search and replace

$line =~ s/input(?= .*clk)/output/g;

Untested since no test cases were provided.