Hello monks :)
I understand that option like -i do something like this around the script:
#!/usr/bin/perl
while (<>) {
if ($ARGV ne $oldargv) {
rename($ARGV, $ARGV . '.bak');
open(ARGVOUT, ">$ARGV");
select(ARGVOUT);
$oldargv = $ARGV;
}
s/foo/bar/;
}
continue {
print; # this prints to original filename
}
select(STDOUT);
My question here is, let's say you want to use -i and to destroy the .bak files generated by your script after it has processed all your files (I am forced to make backups because I'm on windows).
How can you "access", I mean write some code after the line:
select(STDOUT) in the code above?
Thanks a lot!