use strict; use warnings; my @vor = qw(a b c); my @nach = qw(x y z); my @Liste = qw(7 6 5 4 3); my $re = qr(^6$); my @Neu = map { /$re/ ? (@vor, $_, @nach) : ($_) } @Liste; print @Neu, $/;