Character classes are formed at regex compile-time, and \1
isn't a backreference until regex run-time, so your character class is saying "all characters except the character with octal code 001". Try something like:
$word =~ /(e)(?!\1)(.)e/s;
which reads "match an e, then, making sure we CAN'T match an e, match ANY character, then match an e." The /s
is there so that .