Could it be ; $ct**2) is not doing what you think it is? The expression does not alter $ct. It may be that you intended something like $ct += 2.

Update:

I'd expect that you should get a heads up about "useless use of exponentiation (**) in void context" if you are using strictures (use strict; use warnings;). If you are not using strictures I strongly advise that you do!

You should really avoid using global variables ($writeCounter appears to be global).

If @forkarray is local there is no need to initialize it. If it's required outside the sub it should either be passed in by reference or returned to the calling code.

Code in a loop of the form:

if (...) { ... } else { last; }

is cleaner as:

last unless ...; ...

because it removes a level of nesting and makes the condition for last clearer.

An early exit before the second for loop would clean the code up in a similar fashion:

return unless fork (); for (...) { ... }

Perl is environmentally friendly - it saves trees

In reply to Re: meddling with forces I can't understand by GrandFather
in thread meddling with forces I can't understand by downer

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.