map{$_ && s/\s.*//} $server,$user,$passwd,$dbconn,$dbuser,$dbpasswd,$s
+hpath;
Map goes through the trouble of creating and returning a result for you. If you don't intend to use that result, you should probably not use map for the purpose.
I would do this instead:
s/\s.*// foreach ($server,$user,$passwd,$dbconn,$dbuser,$dbpasswd);
$shpath =~ s/\s+.*// if $shpath;
I'm on the fence about treating $shpath separately. There's no reason to test all the variables (according to the OP code), just the $shpath variable. So testing all the other values is wasted CPU cycles. On the other hand, CPU cycles may not be important in this situation.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.