>Can anyone explain to me how map works in this code? > print map { "$_:\t$h->{$_}[0]\n"} keys %$h ;
Essentially, this is a "cheap" way to do a foreach loop to print out each item in the %$h (or %{$h}) hash. It is functionally equivalent to: foreach $key (keys %$h) { print "$key:\t$h->{$key}[0]\n"; } The only difference being that print is called once after building all the output lines, rather than being called for each line. (I assume you are asking about the function of the map {} statement and not the data structures involved....) ---Larry +------------------------------------------------------------------------+ | Larry Coffin, G.P.H. Watertown, MA | | http://www.PointInfinity.com/lcoffin/ [EMAIL PROTECTED] | +------------------------------------------------------------------------+ Kirkland, Illinois, law forbids bees to fly over the village or through any of its streets. - -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]