Maybe this wasn't part of your original question, but your more complete posting of code contains some things you ought to fix. In particular, this condition has a couple problems:
if (($site =~ "l",) || ($site =~ "c") || ($site =~ "n") || ($site =~ "w"))

Apart from the extra comma, the use of the "=~" operator with literal strings seems wrong here; the intention was either this:
if ( $site =~ /[lcnw]/ )
or this:
if ( $site eq "l" or $site eq "c" or $site eq "n" or $site eq "w")

which could (should) be stated this way:
 if ($site =~ /^[lcnw]$/)

The other problem is that, as written, it actually acts like the first alternative, which means that it will match when $site contains "wf", and as a result, the subsequent condition will never get a chance to work:

elsif ($site =~ /wf/)

Also, you are repeating the same statements in these three successive conditional blocks.

If you really want "$site" values containing "wf" and "h" to remain unchanged, while other "$site" values (that might contain a "w") get changed to "l" -- and in all other respects these cases get the same treatment -- do it this way (assuming that "$site" should be a single letter or "wf" only):

if ($site =~ /^([lcnh]|wf)$/) { # one block handles all cases $site = "l" unless ( $site =~ /(h|wf)/ ); $server = "yos.$site.com"; # and so on }

In reply to Re: Re: Re: SOS by graff
in thread Need help understanding legacy code with forking (was : SOS) by perl_virgin

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.