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.
#!/bin/perl
local $^I = "sub/.bak";
local @ARGV = ('/home/antony/perl/l.pl');
while ( <> ) {
s/instance/NEW_PATTERN/;
print;
}
I got the following error.
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.
1) what's wrong with the above code? Is the backup should reside in the same directory?
"Keep pouring your ideas"