I am appending information to a file with the following:
# 0 to go directly to the web, or 1 to authorize first $auth = 0; if ($auth == 0) { LINE: for ($i=0; defined($i); $i++){ unless (-e "./data/$month.dat") { open (FILE, "+>>./data/$month.dat"); flock(FILE,2) or next LINE; print FILE "$event\|$month $day $year\|$place\|$addr\|$desc\|$contact\ +|$phone\|$county\|"; close FILE; last LINE; } } # Tried to add this to get access to file, but didn't work # chmod 0666, "./data/$month.dat"; }elsif ($auth == 1){ LINE: for ($i=0; defined($i); $i++){ unless (-e "./tempevents/$i.dat") { open (FILE, ">./tempevents/$i.dat"); flock(FILE,2) or next LINE; print FILE "$event\|$month $day $year\|$place\|$addr\|$desc\|$contact\ +|$phone\|$county\|"; close FILE; last LINE; } } } # End
It works when auth is set to 1 because it just creates a file for each post. When it is set to 0, I am appending information to a file. During the first post, it works fine, after that, I can't post to it or nothing, it just hangs. I have tried the script with >>, +<, >+, and +>>. Any ideas on why this doesn't work after the first post? I have also tried running chmod as it is commented out above. Thanks, Jason Bush

In reply to File not responding after first append by jrbush82

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.