G'day smturner1,
Welcome to the monastery.
While you're learning, you'll find it useful to use the diagnostics pragma, i.e.
...
use strict;
use warnings;
use diagnostics;
...
This will provide more detailed explanations of the normally much shorter warning and error messages you receive.
This is a developer tool that produces a lot of output that's typically unsuitable for endusers: it's generally a good idea to either delete or comment out the use diagnostics; line in your production code.
Follow the link I provided for a more complete description.
In addition to the already lengthy list of issues, it looks like you may have another problem with:
my $destinationDir = 'C:\Users\Shaun\Documents\$website';
unless the $destinationDir path does in fact end with a directory that's literally called "$website".
As you haven't declared the $website variable, that could be an omission or that could be exactly what you intended. Regardless, I'll point out some issues that might at least be useful for future reference.
Variables do not interpolate within single quotes, so $website will evaluate exactly to the string "$website" and not to whatever value was assigned to $website.
Simply changing the single-quotes to double-quotes does not fix this situation. Every character preceded by a backslash ('\') is considered to be escaped (i.e. it has some special meaning).
"C:\Users\Shaun\Documents\$website" will be parsed as follows:
-
\U - no character will be printed for this but all remaining characters will be converted to uppercase (see uc).
-
\S - this produces the warning "Unrecognized escape \S passed through at ..."
-
\D - this produces the warning "Unrecognized escape \D passed through at ..."
-
\$ - this produces a literal '$' and the following characters 'website' will not be considered part of the $website variable but will be used verbatim.
All of this means that "C:\Users\Shaun\Documents\$website" will evaluate to:
C:SERSSHAUNDOCUMENTS$WEBSITE
To fix this, you'd need to escape the escapes, i.e. change each instance of '\' to '\\':
"C:\\Users\\Shaun\\Documents\\$website"
Clearly, this is now becoming rather messy, less readable and error-prone.
A better way to deal with this (from coding, maintenance and portability perspectives) is to use the core module File::Spec.
In this specific instance, you could simply write:
File::Spec->catfile('C:\Users\Shaun\Documents', $website)
[Aside: When posting questions about error messages you receive, we can provide much better help if you post the exact error message rather than a rough description of it.
Details about this, as well as other guidelines for posting here, can be found in "How do I post a question effectively?".]
|