in reply to Working on pattern matching

You didn't check whether open succeeded so you didn't spot that the $input_file is incorrect. See the Basic Debugging Checklist for more like this.