#!/usr/bin/perl $^I = ".bak"; while (<>) { s/pattern/replacement/; print; }