in reply to Return a hash value based on its key

The difficulty you are having is because check returns the ten element list of key-value pairs, not the value associated with the passed key. You'll get your expected result if you include the explicit return statement return $message{$ck}; as the last line of your sub.

As a side note, you should make sure that code you post passes perl -c (compiles). Yours does not because you didn't include a line like:

my $csv = Text::CSV->new;

#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.

Replies are listed 'Best First'.
Re^2: Return a hash value based on its key
by Anonymous Monk on Feb 16, 2016 at 19:52 UTC
    You're right, thanks for helping!