foreach (@vars){ $_ =~ s/main:://g; if ($_ !~ m/::/){ if ($_ =~ m/^[a-z]/){ local $$_ = $$_; } } }