in reply to Re: How do you clean up user specified filenames?
in thread How do you clean up user specified filenames?

The problem with tr/A-Za-z_.-//dc; is that the . character could be used to attempt to open the current or parent directory.

I'm paranoid enough to do something like

tr/A-Za-z_.-//dc; s/^\.+$//;
to make sure the user doesn't enter a string containing only dots.