my @cleanup = ('an', 'array', 'of', 'words'); for (my $i = 0; $i < scalar(@c1eanup); $i++) { $cleanup[$i] =~ s/oldserv001/newserv001/ig; }