Re: Readline using foreach and while
- From: Uri Guttman <uri@xxxxxxxxxxxxxxx>
- Date: Sat, 29 Mar 2008 16:02:37 GMT
"s" == szr <szrRE@xxxxxxxxxxxxxxx> writes:
>> Absolutely not. my %h = map { $_ => 1 } qw/a b c/; is quite a common
>> idiom.
s> Well, you're still getting that many *sets* which is probably what I
s> should of said, or have been clearer. In that example, you get 3 set of
s> hash pairs resulting from the 3 element list. The point is you get
s> count_of_passed_list amount of something from the map, in some form or
s> another. How exactly it's returned is determined by the template inside
s> the map.
you are still missing the picture. map can return ANY number of elements
(not sets). it executes its expression/block once for each input element
but that can generate 0-?? elements which are appended to the return
list. there are no boundaries in those elements so there are no true
sets. if you return a reference which holds stuff you can force your own
boundaries and make sets. that is also a known map idiom. map generates
a new list from input from another list. the transformation can be
anything and isn't tied to how many input elements there are.
uri
--
Uri Guttman ------ uri@xxxxxxxxxxxxxxx -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
.
- Follow-Ups:
- Re: Readline using foreach and while
- From: szr
- Re: Readline using foreach and while
- References:
- Readline using foreach and while
- From: Saurabh Jain
- Re: Readline using foreach and while
- From: szr
- Re: Readline using foreach and while
- From: Ben Morrow
- Re: Readline using foreach and while
- From: szr
- Re: Readline using foreach and while
- From: Ben Morrow
- Re: Readline using foreach and while
- From: szr
- Readline using foreach and while
- Prev by Date: Re: Memory issues
- Next by Date: Re: Readline using foreach and while
- Previous by thread: Re: Readline using foreach and while
- Next by thread: Re: Readline using foreach and while
- Index(es):
Relevant Pages
|