in reply to searching the strings

It sounds like you are you trying to prevent users from making your open do something unexpected. Why don't you just use the 3-arg version of open (e.g. open(FH, '<', $filename)) instead? With the three 3-arg open, >, <, etc no longer have special meaning in the filename argument.