http://qs321.pair.com?node_id=1093960


in reply to Re: Passing variable to if statement
in thread Passing variable to if statement

I removed the "once" modifier and now the code works perfectly.

I don't think the code is working perfectly. If any of the names in array.txt have regular expression metacharacters in them, then the regular expression pattern you're using is unlikely to match the text as you expect it to.

See perldoc -f quotemeta.