Okay, the first thing you should do is construct a very small example. Your example should read two files only, and each file should only have two lines in it. Then you need to post those two files and try to describe what you are doing. For instance, "Given these two files, I want to produce this output....".
But really, when you are starting out programming, none of your programs should be longer than 10 lines of code until you learn the basics. Your code also needs to be readable, and yours isn't because sometimes you indent your code and other times you don't. In addition, perl indenting is 4 spaces, so you should configure your computer programming editor to indent 4 spaces. If you are not using a computer programming editor, that is your first mistake. There are many free computer programming editors which you can download, and they will automatically indent your code, and provide syntax highlighting, etc. which makes typing, editing, and debugging your code much easier.
Use of uninitialized value $xC1 in subtraction (-) at getrmsd2.pl line
is pretty easy to understand. It is saying that you never assigned a value to $xC1.