I think you may have had a problem while cut'n'pasting, since I don't see where you flock each of the new files and line 22 by my (vim's) count contains only the closing brace for the while loop. Perhaps you could repost the code, or even just the lines that are missing? Also, you seem to have a single element list in void context on the line immediately after the open (within the while loop). It looks like it might've been part of a function call but I'm not certain.

Beyond that, I'm curious why you are locking the newly created files. Is this script supposed to be run while the server is active and other processes are possibly attempting to read these files? If the reading process has good enough error checking (ie, an empty file is assumed to be 0) then it probably shouldn't matter. *shrug*

As for the FTP issue, how exactly are you executing the script via FTP? Is there a SITE command set up to execute programs? That sound like it might be a huge security hole. I'm not a security expert, however. As for the actual question (re: slowness), I don't really have any ideas. Perhaps if you post the missing lines...

Ah well, those are my (unfortunately rather unhelpful) thoughts. Hope you can make something from them, and see if you can get those missing lines here and I'll take another look through. Good luck.

bbfu
Seasons don't fear The Reaper.
Nor do the wind, the sun, and the rain.
We can be like they are.


In reply to (bbfu) Re: using loop/array to write files by bbfu
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.