You are correct, I should remove the lines "used File::Copy? Or Cwd:" since I don't know what they mean.
Perl is one of those long-established languages which has very extensive documentation. Your installation should have the perldoc command which will help but if it is not there you can use the online version instead (see how the word perldoc looks like a link? It is one!). The customary place to start is with perlintro but you can follow the "use" link in my previous post which explains in a rather dry way what that command does. You have lots of reading ahead of you!
I was copy the template from other blogs and forgot to remove them.
It's tempting when learning a new language to just copy code from somewhere else and hack it about to make it do something slightly different. However, it does pay to understand the code you are copying before you start to hack it about.
I want to use the "my $dir.." because I want to verify and make the files that I am working on are in the same directory as the Perl scrip.
Fine, but you are not using it in this example. The principle of an SSCCE is to reduce the example code to the minimum required (the first S stands for "Short"). It's a distraction to you and us so you may as well remove it for now. $dir isn't doing what you think anyway.
I used sub main because I need to the script to do multiple tasks after it is merging.
OK, but be careful about scoping. And try to avoid the particular word "main" since that's also a built-in package name in Perl and as a beginner you may get confused between warnings/errors which relate to either your "main" sub or the main package.
Keep at it - you are at the beginning of a long, winding, fascinating and ultimately fulfilling path. We all started where you are now.