in reply to Using expressions in arrays for pattern matching

Where you have:
open INPUT, "$i" or die "Couldn't open the file. $!";
you may want to say open INPUT, "< $i", or better yet open INPUT, "<", $i instead in case you get files beginning with |, <, or >