Im new to programming and have a hard time understanding Perl. I have a problem with trying to copy over a file that has spaces in the file name('R_BCE_4WklyMonthlyTrackingReport District 110.pdf'). how would I concat the file name or what would be the best way to do this so that copy will be able to copy the file to my directory? Below is the code thanks in advance.
@dist_list = ("110 100 196");
@districts = ("110");
foreach my $dst (@districts) {
foreach my $dist (@dist_list) {
# Copies District files into the directories
#print "$all_store_info\n";
my @array = split(/ / , $dist);
#print "@array\n";
#print "{ $dst \n and $array[0] }\n";
if ($array[0] =~ /^$dst$/) {
my $dt = $array[0];
my $rgn = $array[1];
my $grp = $array[2];
print "$dt test $rgn test $grp\n";
my $dir = "H:/Scripts/BestCreditEver/pdf_docs/company/R$rg
+n/G$grp/D$dt";
if (-d $dir) {
#print "It Exists: $dir\n";
copy 'R_BCE_4WklyMonthlyTrackingReport District 110.pd
+f',"$dir/R_BCE_${acct_wk}WklyMonthlyTrackingReport District $array[0]
+.pdf";
#print "H:/Scripts/BestCreditEver/pdf_docs/company/R$r
+gn/G$grp/D$dt/R_BCE_${acct_wk}WklyMonthlyTrackingReport District ${dt
+}.pdf\n";
}
else {
print "Does Not Exist: $dir\n";
#mkdir "H:/Scripts/BestCreditEver/pdf_docs/company/R$r
+gn/G$grp/D$dt" unless -d "H:/Scripts/BestCreditEver/pdf_docs/company/
+R$rgn/G$grp/D$dt";
print "Dir $dir has been created.\n";
copy "R_BCE_${acct_wk}WklyMonthlyTrackingReport Distri
+ct $array[0].pdf","$dir/R_BCE_${acct_wk}WklyMonthlyTrackingReport Dis
+trict $array[0].pdf";
}
}
}
}