in reply to Re^3: passing array ref without variable
in thread passing array ref without variable

No I do not want to pass a hash. What I want to do is having a hash ($h{key} = value) and
sub my_function { my $arr_ref = shift; ... }
I can pass keys as an array ref by
my_function([keys %hash])
Now, I want to pass values as an array ref in a shortest way without forming an array. Is it possible?

Replies are listed 'Best First'.
Re^5: passing array ref without variable
by FunkyMonk (Bishop) on May 03, 2010 at 21:15 UTC
    Hmmm.

    You know that you get the keys of a hash using a function called keys.

    What do you think would be the name of the function that returns the values of a hash?

Re^5: passing array ref without variable
by LanX (Saint) on May 03, 2010 at 21:26 UTC
    Is it possible?

    Short answer, yes!

     my_function([values %hash])

    but please be aware that this is only a flat copy.

    Cheers Rolf

      what is a "flat copy?"