for my $i (reverse 1 .. $#$e) { splice @$e, $i-1, 2, ["'", $e->[$i-1]] if $e->[$i] eq "'"; }