Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
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!#!/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);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Question regarding options like -i -n -p
by Corion (Patriarch) on May 29, 2013 at 20:28 UTC | |
|
Re: Question regarding options like -i -n -p
by Laurent_R (Canon) on May 29, 2013 at 20:34 UTC | |
by AnomalousMonk (Archbishop) on May 29, 2013 at 21:16 UTC | |
by Laurent_R (Canon) on Jun 01, 2013 at 21:24 UTC | |
|
Re: Question regarding options like -i -n -p
by SuicideJunkie (Vicar) on May 29, 2013 at 20:25 UTC |