It looks like you have a few problems with that code. If you want it to work with warnings and strict enabled then:
my $last_4_chars = '0001'; my @all_stores = map { # This sas file will seperate the datasets by stores # Opens file to write to open my $fh, '>', "weekly_${_}_pdf.sas" or die "Cannot open weekly +_${_}_pdf.sas: $!"; [ $_, $fh ] } qw( 24 25 ); for my $store ( @all_stores ) { print { $store->[ 1 ] } <<STORE; libname bce '/cdw/dept/dss/home_dir/s006258/BCE'; proc sql; SELECT FILEDATE,RPTSTORE,RPTTEAM,FIRSTNAME,LASTNAME,WTDTRAN, WTDOFFERS,WTDAPPS, substr(WTDOFFERS/WTDAPPS,0,5) as WTD_RATE, (case when (substr(sum(WTDAPPS)/sum(WTDOFFERS),0,4)*100) >= 1.2 then + 'G' when (substr(sum(WTDAPPS)/sum(WTDOFFERS),0,4)*100) <= 1.2 and (substr(sum(WTDAPPS)/sum(WTDOFFERS),0,4)*100) >= .65 then + 'Y' when (substr(sum(WTDAPPS)/sum(WTDOFFERS),0,4)*100) < .65 then +'R' end) as WTD_Color MTDTRAN,MTDOFFERS,MTDAPPS, substr(MTDOFFERS/MTDAPPS,0,5) as MTD_RA +TE, (case when (substr(sum(WTDAPPS)/sum(WTDOFFERS),0,4)*100) >= 1.2 then + 'G' when (substr(sum(WTDAPPS)/sum(WTDOFFERS),0,4)*100) <= 1.2 and (substr(sum(WTDAPPS)/sum(WTDOFFERS),0,4)*100) >= .65 then + 'Y' when (substr(sum(WTDAPPS)/sum(WTDOFFERS),0,4)*100) < .65 then +'R' end) as MTD_Color FROM bce.yearly_g${last_4_chars}v00 WHERE RPTSTORE = $store->[0] Order by RPTTEAM STORE } close $_->[ 1 ] for @all_stores;

In reply to Re: Printing to file by jwkrahn
in thread Printing to file 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.