Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re^2: How does map work?

by three18ti (Scribe)
on Oct 26, 2013 at 20:36 UTC ( #1059842=note: print w/replies, xml ) Need Help??

in reply to Re: How does map work?
in thread [Solved] How does map work?

thanks for the assist. Indeed my use of while was incorrect

Indeed HOP does doe a version of map that takes an iterator, and I'm sure it will just take plugging away at HOP some more, it starts to make sense after a few read throughs...

Replies are listed 'Best First'.
Re^3: How does map work?
by LanX (Bishop) on Oct 26, 2013 at 21:57 UTC
    Hmm seems like HOP doesn't show how to reimplement plain map.

    But as a side note, perlsub has an example for grep :

    And here’s a reimplementation of the Perl "grep" operator: sub mygrep (&@) { my $code = shift; my @result; foreach $_ (@_) { push(@result, $_) if &$code; } @result; }


    Cheers Rolf

    ( addicted to the Perl Programming Language)

Re^3: How does map work?
by muba (Priest) on Oct 28, 2013 at 18:31 UTC

    There is one instance where while sets $_ (or at the very least has the appearance to do so), and that's in the special while( <$filehandle> ) {...} construction (or ... while <$filehandle> for that matter, I believe).

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1059842]
[Your Mother]: Please don't fight, mom and dad!
[erix]: friction gives warmth!
LanX comes back ...
[LanX]: FIGHT?
LanX orders pop corn
[erix]: ha ha, you missed it

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2018-03-19 21:24 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (246 votes). Check out past polls.