piou20100 has asked for the wisdom of the Perl Monks concerning the following question:

Since the chatterbox answer did not solve my problem, I'll ask here.

I'm doing this in perl 5.22 without any problem. hash is a hash of hashes. It looks like this:

a: key1 value1 value2 value3 value4

b: Key2 value5 value6 value7 value8

The code looks like this:

combine(%hash{$key}) sub combine { my (%params) = @_; my ($key, @value) = %params; print "This is the key $key\n"; }
This work fine in perl version 5.22 but in perl 5.8.4 it gives me a syntax error and it says this:
syntax error at script.pl line 166, near "%hash{"

If I try to use a $ instead of a % like it was suggested in the chatterbox, the subroutine spits out:

This is the key ARRAY(0X327060)

How can I make this work in version 5.8.4 or is it impossible? Thanks

Replies are listed 'Best First'.
Re: Hash of hashes and subroutine
by Anonymous Monk on Jul 20, 2016 at 02:11 UTC

      Thanks for your reply.

      Changing my call to:

      combine($key, $hash{$key})

      made it work in version 5.8.4 as you suggested.