in reply to howto map/grep a complex structure

thank you,

because i've got two equivalent answers to this questions, which didn't come up with map, i still think it would be nice to see a solution with map / grep combination.

but maybe this example is not the best for such a solution.

your way is anyway more elegant than my neested foreach loops with an if statement.

greetings

Replies are listed 'Best First'.
Re^2: howto map/grep a complex structure
by NetWallah (Canon) on Aug 27, 2015 at 05:53 UTC
    You are SEARCHING (grep) not TRANSFORMING (map), so map is not necessary.

    Here is a one-liner that works, but I would not recommend writing unreadable code like this.

    print for grep { grep {$search eq $_ } @{$href->{$_}->{member}} } keys %$href;

            Clarity: it's like that one thing that is not the other thing, except for when it is.