I'm not quite clear on what you're trying to do. It sounds as if maybe you have more than one conference at a time, and you want to store them all under the same hash key.

I suggest that you work with hash references that contain all of the conference information in one hash.

{ time => $time, conference => $value1, type => $value2, comment => $value3, }

You can take one of those and stick it in a hash of arrays (of hashes) or just have an array of them.

push @AoH, { time => $t, conference => $v1, ... };

Then you can sort the array by time when you want to output them.

my @sorted_AoH = sort { $_->{time} <=> $_->{time} } @AoH; foreach my $conf ( @sorted_AoH ) { my $time = $conf->{time}; print ... # element }

If you need random access to these records by time, then you can put them in a hash as you have them but add a layer of array to it.

push @{ $hash{$time} }, { time => $time, type => $v2, ... };

Then you need an extra loop when dealing with them.

for my $time ( sort keys %hash ) { for my $conf ( @{ $hash{ $time } } ) { print ... # $conf element } }

Again, I'm not clear from your description what you're trying to do, but maybe this gives you some ideas.


In reply to Re: question about multi value hash key by kyle
in thread question about multi value hash key by joybee

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.