do { $a_counter = 0; foreach my $x(@left_split) { if($x eq '') { splice @left_split, $a_counter-1, 1; $bool = 1; last; } } }