for $bird (@birds) { next unless $bird =~ /bar/; $bird =~ s/puffin/poppin/; print $bird; }