Hi! Thanks for all the replies. I have taken some advice and tried to fix up the script, but I still can't use the "use strict;" line, I get an error.

Also, when I execute the script, then try to open the foler in ws_ftp, it hangs and I have to hit the "Refresh" button in ws_ftp. Then the folder opens and the files are displayed. I am thinking that maybe the $adfile is not being closed?

Here is the new code:
#!/usr/bin/perl #use strict; can't use this, I get an error... my $adfile = '/home/ebrae2/adskingston-www/cgi-bin/ebrae/data/ads.data +'; my $hits_dir = '/home/ebrae2/adskingston-www/cgi-bin/ebrae/hits/'; $os = $^O; open(FILE, $adfile) || die "Can't open $adfile"; while ($line = <FILE>) { chomp $line; my @counter_file = split(/\|/,$line); open (HITS_FILE, ">$hits_dir/$counter_file[0].txt") || die "Can't cr +eate file"; ("$hits_dir/$counter_file[0].txt"); print HITS_FILE "0"; close (HITS_FILE); if ($os eq "unix") { chmod 0666, "$hits_dir/$counter_file[0].txt"; } } close(FILE); if ($os eq "unix") { chmod 0666, "$adfile"; } print "Content-type: text/html\n\n"; print "<BR><CENTER>"; print "<form><input type=button value=\"Success!\" onClick=\"locatio +n.href('http://www.adskingston.com')\"></FORM>";
Can anyone see from looking at this code, what I am doing wrong? Thanks!

In reply to Re: Re: using loop/array to write files by ginocapelli
in thread using loop/array to write files by ginocapelli

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.