#!/usr/bin/perl use strict; use warnings; my @array = ("hallo", "du", "bist ja\n immer noch", "da"); print "'$_'\n" for @array; my $i = $#array; while ($i>=0) { my $count = $array[$i] =~ y/\n//; splice @array, $i, 1, split /\n/, $array[$i] if $count; --$i; } print "'$_'\n" for @array;