http://www.perlmonks.org?node_id=286405


in reply to Apply function "keys" directly to function returning hash

The problem is that you're *not* returning a hash - you're returning a list, which my %hash = func() turns into a hash for you.

One way round this would be to return a hashref instead - something like this...

sub func { return {'a' => 'ah', 'b' => 'be'} }; print keys %{func()}; # a b
Hope this helps,
Ben.