#!/usr/bin/perl -w use strict; my @array = qw( one 1{ two } three 2{ four five } six ); my $i = 0; my $start; while ( $i <= $#array ) { if ($start && $array[$i] =~ /}/) { splice @array, $i, 1; undef $start; $i++; } if ($start || $array[$i] =~ /2{/) { $start = 1; splice @array, $i, 1; } else { $i++; } } print @array;