while( <$fh> ) { chomp; next unless length; if( /start/ .. /end/ ) { push @array, [ split /\s+/, $_ ]; } }