use strict; my $i = 0; my $j = 0; my @result; while() { chomp; $result[(++$i % 2) ? $j++ : $j - 1] .= $_; } __DATA__ >text 4 'As the low pressure moves in, the winds should slacken towards the end of the day. Will be a smaller day than Tuesday, but the odd clean wave should be found at some spots.' >text 8 'Unsure as to what the winds will do more today as it'll depend a lot on the track of the low pressure.' >text 9 'It'll be near calm and mellow conditions, although there's a chance of perhaps the odd kneehigh set wave for the North coast.' #### use strict; my @data = ; my @result; chomp foreach @data; for (my $i = 0; $i <= $#data; $i += 2) { push(@result, {header => $data[$i], text => $data[$i + 1]}); } __DATA__ >text 4 'As the low pressure moves in, the winds should slacken towards the end of the day. Will be a smaller day than Tuesday, but the odd clean wave should be found at some spots.' >text 8 'Unsure as to what the winds will do more today as it'll depend a lot on the track of the low pressure.' >text 9 'It'll be near calm and mellow conditions, although there's a chance of perhaps the odd kneehigh set wave for the North coast.'