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"; } } } }

In reply to File NCopy concat by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.