Use the block form:
```
inreplace "Makefile.PL" do |s|
  s.gsub! ...
  s.gsub! ...
  s.gsub! ...
  s.gsub! ...
end
```