note gwadej <p>I'm sorry. I appear to have added to the confusion, rather than clarifying. I should have begun by saying that I avoid using <code>map</code> or <code>grep</code> in <code>void</code> context.</p> <p>What I was commenting on was your suggestion that the only reason for using those operators was that they are more concise and show a better grasp of Perl.</p> <p>An example of what I was trying to say is the code example below.</p> <code> my @minutes = map { $_ / 60 } @seconds; </code> <p>In the <code>foreach</code> style, this would be</p> <code> my @minutes = (); foreach my $sec (@seconds) { push @minutes, ($sec / 60); } </code> <p>To me, the first signals the intent to transform a list of times in seconds into an equivalent list in minutes. The second has pretty much the same effect, but I have to <em>read</em> the code to see what the output is. In the first case, it seems obvious (to me, at least) that the output is the left side of the assignment.</p> <p>Although this may seem like a simple example. I find many times that I can use these operators to reduce the <em>noise</em> characters in code like this. Sometimes that reduction is enough to make the overall code clearer by not spending space on relative minor pieces of logic.</p> <p>Granted, if the code inside the block gets complicated enough, I may change to the <code>foreach</code> style to emphasize the fact that this is not a <em>simple</em> transformation.</p> <p>I see this as a Perl idiom that can convey information to the maintainer when used carefully. I do agree that it can be horribly misused. (The less I say about that the better.&lt;grin type="embarassed"/&gt;</p> <div class="pmsig"><div class="pmsig-278098"> G. Wade </div></div> 296742 296851