>>>>> "BM" == Brandon McCaig <bamcc...@gmail.com> writes:
BM> On Fri, Sep 16, 2011 at 2:55 PM, Paul Johnson <p...@pjcj.net> wrote: >> map EXPR, @a is just the same as map { EXPR } @a. BM> The part that I find confusing is that EXPR is evaluated against each BM> $_, as opposed to once when map is called, passing the resulting value BM> into map. :) Obviously it's just one of the many magical features of BM> Perl at work here. :) I don't think that there's any way for a BM> user-defined sub to do this; or is there? the whole point of map/grep is to evaluate the expression/block for each element of the input list. so there has to be a way to access the current element in the expression and that is $_. and i just posted in this thread you can pass a code block to a sub as the first argument by using prototypes. File::Slurp::edit_file_lines does both of those tricks. uri -- Uri Guttman -- uri AT perlhunter DOT com --- http://www.perlhunter.com -- ------------ Perl Developer Recruiting and Placement Services ------------- ----- Perl Code Review, Architecture, Development, Training, Support ------- -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/