in reply to Changing the contents of a file
while(<DATA>) { s#(elephant\s+\*\s+)(.*?)\w+$#$1$2fox# if (!/-ugly/); print; } __DATA__ elephant * -ugly /leave/this/alone elephant * /only/change/->/turkey elephant * turkey elephant * -ugly /leave/this/alone elephant * /only/change/->/turkey elephant * -ugly /leave/this/alone elephant * turkey
|
---|