>> that is a poor explanation IMO.

hell, i was going to give this which dereferences the reference of a
reference DBI's selectall_arrayref returns so that i can later loop
through it again and again with different parameters:

my (@groups) = map {...@$_} @{ $dbh->selectall_arrayref("select distinct
org from groups") };

but, i didn't want to confuse the subject. just thought i'd post this
as an example of map's usefulness.

use Data::Dumper to figure out what you're getting returned and then
use map to put it in the format that you prefer.

though, Uri's explanation was much better than mine IMHO :)
but, as he said, whatever you can do with map, you can do with a
foreach loop and vise versa. whenever you find yourself writing a
foreach loop, just remember that you may want to consider map (i don't
know the benchmarks, i just use it for style at this point).

-- 
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