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

Hi, if I declare a hash like this:

$java{"aaa"}=@output;

and lets say that $output[0]="aaa";

how can I print the string "aaa" and how can I add alements to @output?

Thanks Tsvika.

jcwren 2001/12/25 Added code tags

Replies are listed 'Best First'.
Re: array inside a hash
by merlyn (Sage) on Dec 25, 2001 at 21:56 UTC
Re: array inside a hash
by hotshot (Prior) on Dec 25, 2001 at 21:20 UTC
    I fyou ment to print the string "aaa" of the array (and not of the hash as in the example you gave), then do this:
    print "string:", $java{aaa}[0];
    for adding elements tothe array:
    push(@{$java{aaa}}, $element); # or: $java{aaa}[$index] = $element;
    These are elementry things and I suggest you read the Tutorials.

    Hotshot