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
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.