I have a simple script that simply copies a file from one location on a Win2K system to another location on the same server. My problem is in the "" in the copy command. I need to rename to copied file to a name which contains a variable and I am getting multiple errors. Here is my code:
I am not sure where to put the "".
Here are the errors:
Any help is appriciated.
Code:
use File::Copy;
my $logpath = "D:\\file_share\\ov_share";
my $ftppath = "D:\\ovmon";
my $hostname = "n2vftp004";
my @logarr = ("templrep.log","time_log");
foreach (@logarr) {
copy ("$logpath\\$_",("$ftppath\\"monout_".$hostname.".txt"));
}
exit(0);
I am not sure where to put the "".
Here are the errors:
Code:
Bareword found where operator expected at D:\File_Share\OV_Share\Perl Scripts\pg
plog.pl line 18, near ""$ftppath\\"monout_"
(Missing operator before monout_?)
String found where operator expected at D:\File_Share\OV_Share\Perl Scripts\pgpl
og.pl line 18, near "monout_".$hostname.""
String found where operator expected at D:\File_Share\OV_Share\Perl Scripts\pgpl
og.pl line 18, at end of line
(Missing semicolon on previous line?)
syntax error at D:\File_Share\OV_Share\Perl Scripts\pgplog.pl line 18, near ""$f
tppath\\"monout_"
Can't find string terminator '"' anywhere before EOF at D:\File_Share\OV_Share\P
erl Scripts\pgplog.pl line 18.
Any help is appriciated.