Here is the code to reproduce the problem:
sub hello { return (h => 1, n => 1); }
print join \", \", values hello();
I get the error:
Another thing that you could do is use a toggle variable.
sub hello { return (h => 1, n => 1); }
my $toggle = 1;
print join ", ", grep { $toggle = !$toggle; } hello();
Another thing you could do is use List::Pairwise
use List::Pairwise qw;
print join ", ", mapp { $b } hello();
I had been looking for something to process a list of name-value pairs in a "stream" and even rolled my own, but then I found this on CPAN.