Manfred Lotz wrote:
Hi there,

Hello,

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?

some_action( $_ ) for values %ht;

Or rewrite some_action() to use a list instead of a scalar and do:

some_action( values %ht );


2. Is it a problem when I don't take care about what map returns,
namely a list of 1's?

How do you know that map returns "a list of 1's" if you don't save what map returns?




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