in reply to Re: Overwrite file protection
in thread Overwrite file protection

Or, in a way that reads more naturally (to me, at least)

my $inc; $inc++ until ( not -e "$filename~$inc" );
Note that starting with an undefined $inc eliminates the need for the first check. In other words, the whole sub would be as easy as:
sub good_filename { my $filename = shift; my $inc; $inc++ until ( not -e "$filename~$inc" ); return "$filename~$inc"; }
-sauoq
"My two cents aren't worth a dime.";