Either
uc the sourcefile name also, or use a case insensitive match (see /i modifier in
perlre). But the way your match currently is (maybe you could just use the 'eq' operator?), you would also mistakenly match not just "test_file_name.dat", but also "my_test_file_name.dat" . That is, if your program didn't have a couple of other mistakes. Print the directory and the datfile variables to see what's wrong (hint: backslashes escape characters, and strings should be quoted...also, you can use forward slashes for path separators in Windows unless you are passing the value to a
system function). Also consider using
strict and warnings.