Aside from the syntax, is there a difference in the way 'map' and
'foreach' process?
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
Dan == Dan Sopher [EMAIL PROTECTED] writes:
Dan Aside from the syntax, is there a difference in the way 'map' and
Dan 'foreach' process?
Yes. map is an expression. foreach is a statement. foreach can't
be nested inside a larger expression. map is *meant* to do that,
and using it in a void
On Aug 24, 2:21 pm, [EMAIL PROTECTED] (Dan Sopher) wrote:
Aside from the syntax, is there a difference in the way 'map' and
'foreach' process?
foreach is just a loop. map returns values. Specifically, it returns
the value of the BLOCK/EXPR for each iteration of the loop.
my @doubles = map {
On 8/24/07, Dan Sopher [EMAIL PROTECTED] wrote:
Aside from the syntax, is there a difference in the way 'map' and
'foreach' process?
snip
There are many differences, in addition to what has already been said
map can be more or less cpu efficient than depending on the task*. If
you can use map
Dan Sopher wrote:
Aside from the syntax, is there a difference in the way 'map' and
'foreach' process?
Hi Dan
Internally they're very similar, but you shouldn't be thinking like that.
As Randal said, foreach is a statement - a language construct like 'if',
'while', 'else' and so on - while
Both map and foreach can do the same thing,though they're used in
different syntax environment.
I follow a rule,if you need to return a result list,use map.Otherwise
use for/foreach.
Also sometime we can use map to do some flexible translation,like
Schwartz Translation.
2007/8/25, Dan Sopher
Jeff == Jeff Pang [EMAIL PROTECTED] writes:
Jeff Also sometime we can use map to do some flexible translation,like
Jeff Schwartz Translation.
That's a new one for me. Are you trying to say Schwartzian Transform?
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
2007/8/25, Randal L. Schwartz [EMAIL PROTECTED]:
Jeff == Jeff Pang [EMAIL PROTECTED] writes:
Jeff Also sometime we can use map to do some flexible translation,like
Jeff Schwartz Translation.
That's a new one for me. Are you trying to say Schwartzian Transform?
Yes,sorry for spelling