in reply to Re: Re: SOS
in thread Need help understanding legacy code with forking (was : SOS)
if (($site =~ "l",) || ($site =~ "c") || ($site =~ "n") || ($site =~ "w"))
if ( $site eq "l" or $site eq "c" or $site eq "n" or $site eq "w")
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/)
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 }
|
|---|