On Fri, Sep 16, 2011 at 02:27:08PM -0400, Brandon McCaig wrote:

>   my @column_headers = map trim($_), split /\|/, $header_line;

> Using an EXPR with map is even more confusing to me, but it seems to
> work here so I'll leave it at that. ;D

map EXPR, @a is just the same as map { EXPR } @a.

Some people will tell you that you should never use it.  Some people
will tell you that it is faster since perl doesn't have to create a
scope.  You can safely ignore all those people and use it when
appropriate.

For me, it is appropriate when, as in this case, it reduces clutter and
lets you focus on the intent of the code rather than the syntax.

-- 
Paul Johnson - p...@pjcj.net
http://www.pjcj.net

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to