use warnings; use strict; while () { s/"(.+?)"/"NEW"/; print; } __DATA__ This is line 1 "hello there" the is line 2 "goodbye, take care" this is line 3 "Jump, fox. Jump" #### This is line 1 "NEW" the is line 2 "NEW" this is line 3 "NEW"