I think I'd use something simple like:
my $file = ...; my $n=0; if( -e $file ) { ## Stop endless loop if $file doesn't exist $n++ until rename $file, "$file.bak$n"; } else { die "$file doesn't exist"; } my $backup = "$file.bak$n";
In reply to Re^3: Copying a file to a temporary file
by BrowserUk
in thread Copying a file to a temporary file
by shay
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |