in reply to parsing a file

use strict; my $in = 'sample.txt'; my $out = 'sampleout.txt'; my ($handle, $key, $val); open($handle, $in); # Messy, but I'm assuming a small file... split(/\n\n/, join('', <$handle>)); close($handle); open($handle, ">$out"); for (@_) { print $handle "__BEGIN__\n$_\n__END__\n"; my %hash; for (split(/\n/)) { ($key, $val) = split(/ /); $hash{$key} = $val; } # Do whatever with record data, now inside # %hash as key / value pairs } close($handle);