You should declare %hash outside the while loop otherwise its not visible, when you print the results in the for loop. Time and conference should also be stored as value in hash record although the information is already available in the timeconference multivalued key. This makes later access easy. Try something like this.
use strict; use warnings; my %hash = (); my ($time, $conference, $type,$comment); while(<FILE>) { # adapt parsing values to your need here if (/conference=(.*)/){ $time = $1; } if (/conference=(.*)/){ $conference = $1; } if (/type=(.*)/){ $type = $1; } if (/comment=(.*)/){ $comment = $1; } if (/lastline of record/){ $hash{$time,$conference}{time} = $time; $hash{$time,$conference}{conference} = $conference; # info is a +lready in the key, for easy parsing in the for loop, store conference + twice. $hash{$time,$conference}{type} = $type; $hash{$time,$conference}{comment} = $comment; } } for my $timeconference (sort keys %hash) { printf "time %s, conference %s, type %s, comment %s\n", @{hash}{qw(time conference type comment)}; }

print+qq(\L@{[ref\&@]}@{['@'x7^'!#2/"!4']});

In reply to Re: question about multi value hash key by codeacrobat
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.