shawn wilson wrote:
On Tue, Jan 11, 2011 at 4:57 AM, Sean Murphy<mhysnm1...@gmail.com>  wrote:
Hi all.

I have read the explaination of the Map function and it is still a mystry to
myself on what it is for and when would you use it?

All explainations I have seen in books and blogs don't make it clear.


my @new = map {$_} @arr;

is the same as:

foreach (@arr) {
  push $_, @new;
}

ITYM

foreach (@arr) {
 push @new, $_;
}

Trying to use a scalar as the first argument to push will result in an error message.



John
--
Any intelligent fool can make things bigger and
more complex... It takes a touch of genius -
and a lot of courage to move in the opposite
direction.                   -- Albert Einstein

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to