jesuashok has asked for the wisdom of the Perl Monks concerning the following question:
Hi all great people,
Today I read about using $^I from the following node in perlmonks,
Use $^I (was Re: updating a file)
After that I have written a samle code and checked for the same.
I got the following error.#!/bin/perl local $^I = "sub/.bak"; local @ARGV = ('/home/antony/perl/l.pl'); while ( <> ) { s/instance/NEW_PATTERN/; print; }
1) what's wrong with the above code? Is the backup should reside in the same directory?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.
"Keep pouring your ideas"
Back to
Seekers of Perl Wisdom