Top 10 perl books
Abigail
abigail at abigail.be
Wed Apr 23 21:55:27 BST 2008
On Wed, Apr 23, 2008 at 07:57:20PM +0100, Johan Lindstr?m wrote:
>
> >>> On Wed, 2008-04-23 at 13:49 +0100, A Smith wrote:
> >>>> How many people do you know who could describe the difference between
> >>>> foreach and map in one short paragraph ?
>
> foreach iterates over a list, map transforms a list.
Wrong. Map leaves the list as is - although it's able to alter its elements
because of the aliasing behaviour of $_ - but for has that ability as well.
> At 18:39 2008-04-23, Frank v Waveren wrote:
> >foreach runs a procedure and map runs a function.
>
> I like that one.
Well, foreach runs a block, and one flavour of map does so as well.
The other flavour runs an expression.
I'd say, 'foreach' is a statement, 'map' is an expression.
Abigail
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://london.pm.org/pipermail/london.pm/attachments/20080423/59972428/attachment.pgp
More information about the london.pm
mailing list