in reply to A more efficient way to do this?

This can be accomplished simply and efficiently using a hash:

#!/usr/bin/perl use strict; use warning my @ldapFields = ("unvLocalPhone", "unvLocalAddress", ); my %field_hash = (unvLocalPhone => "Phone", unvLocalAddress => "Address", ); foreach my $field (@ldapFields) { if (exists $field_hash{$field}) { $field = $field_hash{$field}; } }

A hash is an associative array of scalars - it associates a scalar key with exactly one scalar value - and is (IMHO) Perl's single greatest feature. If you are unfamiliar with them, a read through perldata would be a good start.