foreach my $text ( @test ) { my @elements = split( /\n/, $text ); # do something with @elements }