On Thu, 24 Oct 2002 00:03:48 -0700, [EMAIL PROTECTED] (John W. Krahn) wrote:
>You mean something like this: > >my ( $file, $ext ); >do { > $file = sprintf 'test.%03d', ++$ext; > } while -e $file; > >open OUT, "> $file" or die "Cannot open $file: $!"; Exactly. Thank you. I received so many good suggestions. Thanks to all. my $testfile = 'test.txt'; my ( $file, $ext ); if (-e $testfile){ do { $file = sprintf 'test.%03d', ++$ext; } while -e $file; rename ($testfile, $file); } open $fh, "> $testfile" or die "Cannot open $file: $!"; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]