use strict; use warnings; my $heading = ''; my @lines; while (my $line = ) { chomp $line; if ($line =~ /^[1-9]/) {#New heading line ProcessEntry ($heading, @lines) if length $heading; $heading = $line; @lines = (); } else {push @lines, $line;} } ProcessEntry ($heading, @lines) if length $heading; sub ProcessEntry { my $heading = shift; my @lines = @_; print "Heading is: $heading\n"; print "Lines are:\n " . join "\n ", @lines; print "\n\n"; } #### __DATA__ 1. This string can be modified using only regexes -These strings -Need to be -put into an -array 2.Here's another string needs only regexes -But here are more -strings which -I want arrayed #### Heading is: 1. This string can be modified using only regexes Lines are: -These strings -Need to be -put into an -array Heading is: 2.Here's another string needs only regexes Lines are: -But here are more -strings which -I want arrayed