$inc = 1; -e < $filename~1 >;$inc++; # file exists, $inc now 2 $inc = 2; -e < $filename~2 >;$inc++; # file doesn't exist, $inc now 3