in reply to Get the Key corresponding to any given value

my ($key) = grep {$value ~~ $hash{$_}} keys %hash; print "Key = $key\n";

Replies are listed 'Best First'.
Re: Answer: Get the Key corresponding to any given value
by LanX (Saint) on Jan 20, 2014 at 12:50 UTC
    values are not necessarily unique so the left hand side should be a list.

    and using smart match doesn't make sense, better decide if == or eq are appropriate.

    simmisam did you notice that most of your recent answers in this category were rejected by QandAEditors b/c of poor quality?

    And (sadly) I have to say, I hope this one too!

    Maybe you should stop playing this game till you are more experienced?

    Cheers Rolf

    ( addicted to the Perl Programming Language)

      I'm actually OK with this one, but I would prefer that he would include an explanation of the value of his approach, i.e. describe the situations in which he thinks it could be useful.

      I reckon we are the only monastery ever to have a dungeon stuffed with 16,000 zombies.
        > I'm actually OK with this one...

        Well a 90% copy from the second part of the first answer, just that everything changed is worse now.

        I can't see how readers may rather profit instead of being confused or mislead.

        Cheers Rolf

        ( addicted to the Perl Programming Language)