http://qs1969.pair.com?node_id=1062473


in reply to reading from file.

It looks to me like you may have your logic backwards. For any list of with more than one name, it will always print "not valid". I suspect that you meant something like
if input_name is in list: print "valid" else: print "not valid" This could be implemented with the following code: if (grep(/^$input$/, @names) { print "Valid\n"; } else { print "Not valid\n"; }
There are a number of other areas that could be cleaned up. For example, you probably should read the list of valid names before getting your name to test. A little more consistency in your use of brackets would also make your code easier to figure out (both for you and for us.)