On Mon, 20 Feb 2012 20:14:13 +0100 "Christian Walde" <walde.christ...@googlemail.com> wrote:
> On Mon, 20 Feb 2012 20:08:31 +0100, Manfred Lotz > <manfred.l...@arcor.de> wrote: > > > Hi there, > > > > I have a hash table where I want to do some action for each value in > > the hash table. > > > > > > > > Among other possibilities I could do like this: > > map { some_action($_) } values %ht; > > > > where let us say: > > > > sub some_action { > > ... > > > > return; > > } > > > > I like it because it is really short. > > > > > > Questions: > > 1. Is there another perhaps better one liner to do it? > > You can do either of these: > > map some_action($_), values %ht; > I found somewhere: Don't use map or grep in a void context. That is why I answered my own question saying this is bad. > some_action($_) for values %ht; > Interesting, there are many ways to do things in Perl. :-) -- Thanks, Manfred -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/