Why is it that if I try to read in a text file for those variables my file does not move, but if I explicitly define $oldlocation and $newlocation to the EXACT same thing that is contained in the text file it does work? Why does it matter where it gets the information from in order for it to work??

I'm hoping there is a simple explanation as to why this is this way and my goal is to be able to use the text file contents to direct file transfers. Thanks in advance.

Your code is telling me that you explicitly told perl not to tell you why it was failing.

Start by adding these 2 prgmas to your script.

Code

use strict; use warnings;

They should be in every Perl script you write.

The strict pragma will force you to declare your vars, which is done with the 'my' keyword.

You should ALWAYS check the return code of an open call to verify that it was successful and take action if it wasn't. You should use a lexical var for the filehandle instead of the bareword and you should use the 3 arg form of open.

Since you haven't shown us the contents of data.txt, I must ask: are the source and destination on separate lines and are they the only 2 lines in the file? If the answer is no to either of those questions, then that would be the source of the problem.