my @foo = qw/a b c d e f g/; for my $x (@foo) { push @foo, 'd' if $x eq 'd'; print $x; }