use constant FOO => "abc"; my $str = "abcdefg"; $str =~ s<${\FOO}>(\U$&); print $str,$/; __output__ ABCdefg