in reply to incrementing the file
There's a large number of file test unary operators which will check files for existence, size, writability and so on.
It's unclear whether you're renaming an existing file or generating a new, unique filename. If the former, File::Copy may be your best bet (there is a rename function but it has documented limitations).
-- Ken
In Section
Seekers of Perl Wisdom