On Mon, 20 Feb 2012 20:08:31 +0100
Manfred Lotz <[email protected]> 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?
>
> 2. Is it a problem when I don't take care about what map returns,
> namely a list of 1's?
>
>
I guess I found the answer myself:
1. foreach ( values %ht ) { some_action($_) };
2. map using like I did (called void context) is bad.
Sorry for the noise.
--
Manfred
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/