Join and split are sexy, but I rarely use map. It doesn't offer that much in the way of speed difference vs for (which, btw, can be the same as foreach in Perl, only shorter to write), and it makes your code much more complicated to read. There's something so beautiful about being able to do:
@arr = qw/aaa aba abb bac efg/;
tr/a/x/ for @arr;
print join ' ', @arr;
perrin: What's the point of having $_ and @_ if you don't use them? I will agree that any reasonably large sub should define variables for the contents of @_, but it's just so much neater to do a series of regexes on $_ than on a variable. I use it as much as possible.
-
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.
|