If it succeeds, then you'd have to delete it again--assuming the idea is to just check, not actually use.
I assumed the opposite. When we get questions like this, the check is followed by actually opening or creating the file.
How would you do that reliably?
Errno provides codes against which you can check $!.
In reply to Re^3: Regular expression to check for invalid file name characters
by ikegami
in thread Regular expression to check for invalid file name characters
by merrymonk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |