use strict; use warnings; my @records; =~ /^Daily Listing of Reports/ or die "bad report input line 1\n"; =~ /^GW Posted Date/ or die "bad report input line 2\n"; my $record = []; while () { chomp; push @$record, $_; if ( /^R[A-Z]\d{5}$/ ) { splice @{$record}, 2, $#{$record}-2, join ' ', @{$record}[ 2 .. $#{$record}-1 ]; push @records, $record; $record = []; } } use Data::Dumper; print Dumper \@records; __DATA__ Daily Listing of Reports GW Posted Date CRS Publication Date Title Text 01/14/2009 12/09/2008 China-U.S. Relations: Current Issues and Implications for U.S. Policy RL33877 01/14/2009 12/31/2008 Greenhouse Gas Emission Drivers: Population, Economic Development and Growth, and Energy Use RL33970 01/14/2009 12/30/2008 School Construction, Modernization, Renovation, and Repair Issues: 110th Congress RS22894 © Copyright GalleryWatch.com, Inc. (1999 - 2009), provided under license. NO CLAIM TO ORIGINAL U.S. OR STATE GOVERNMENT WORKS