my %hash = f(); my @keys = keys %hash; #### my @keys = keys %{f()}; #or in postfix dereferencing my @keys = keys f()->%*;