#!/usr/bin/perl -w while(){ $_=~s/^(BEGTITLE.*) (wirey) (.*ENDTITLE)$/\1 smooth \3/i; print $_; } __DATA__ BEGPUB Wirey Haired Dogs Life ENDPUB BEGTITLE My dog has wirey hair ENDTITLE BEGTXT My wirey hair dog...blah, blah. ENDTXT