in reply to Re: Map: Thou Has't Confounded Me For The Last Time! (Referring To The Array You Are Assigning To In Map)
in thread Map: Thou Has't Confounded Me For The Last Time! (Referring To The Array You Are Assigning To In Map)

I feel that ikegami has provided the most accurate explanation of the map operator.

This is the beginning of the road to understanding the difference between a list and an array, by the way. You'll see both terms in the perldocs, but you won't see a lot to explain the difference. An array is a variable type. A list is what an array contains, but lists often exist without any array at all. The @anon_temp in ikegami's example is one way of explaining such a list.

Note that foreach is a statement type, while map is an operator. This operator takes one list, and transforms it into a completely new list, element by element.

--
[ e d @ h a l l e y . c c ]

  • Comment on Re^2: Map: Thou Has't Confounded Me For The Last Time! (Referring To The Array You Are Assigning To In Map)
  • Select or Download Code

Replies are listed 'Best First'.
Re^3: Map: Thou Has't Confounded Me For The Last Time! (Referring To The Array You Are Assigning To In Map)
by Anonymous Monk on Feb 15, 2005 at 01:29 UTC

    For future reference, there is a good explanation in the perldocs. It's in perlfaq4, accessible directly via perldoc -q 'list and':

    Found in /usr/share/perl/5.8/pod/perlfaq4.pod What is the difference between a list and an array? # contents snipped to avoid massive annoyance