perlquestion
jesuashok
Hi all great people,
<p>
Today I read about using $^I from the following node in perlmonks,
<a href="http://perlmonks.org/?node_id=128200">Use $^I (was Re: updating a file)</a>
<br>
After that I have written a samle code and checked for the same.
<code>
#!/bin/perl
local $^I = "sub/.bak";
local @ARGV = ('/home/antony/perl/l.pl');
while ( <> ) {
s/instance/NEW_PATTERN/;
print;
}
</code>
</p>
I got the following error.
<code>
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.
</code>
1) what's wrong with the above code? Is the backup should reside in the same directory?
<br>
<br>
</p>
<!-- Node text goes above. Div tags should contain sig only -->
<div class="pmsig"><div class="pmsig-395537">
"Keep pouring your ideas"
</div></div>