#!/usr/bin/perl use strict ; use warnings ; use Data::Dumper ; my @records ; my $count = 0 ; while () { next if ( /^\n/ ) ; # skip newlines if (/^--/) # new record { $count++ ; next ; } my ( $field, @words ) = split ; # get the 2 needed fields $field =~ s/://g ; # drop the ":" my $data = join " ", @words ; # make a string chomp $data ; # remove the newline $records[$count]{$field} = $data ; } print Dumper(\@records); # easy way to unfold the structure __DATA__ From: pminich@foo.com To: esquared@foofoo.com File: value.scr Action: The uncleanable file is deleted. Virus: WORM_KLEZ.H ---------------------------------- Date: 06/30/2002 00:01:21 From: mef@mememe.com To: inet@microsoft.com File: Nr.pif Action: The uncleanable file is deleted. Virus: WORM_KLEZ.H ----------------------------------