#!/bin/perl local $^I = "sub/.bak"; local @ARGV = ('/home/antony/perl/l.pl'); while ( <> ) { s/instance/NEW_PATTERN/; print; } #### Error: Can't rename /home/antony/perl/l.pl to /home/antony/perl/l.plsub/.bak: No such file or directory, skipping file at l line 6.