my $smiley_re = join '|', map { "\Q$_\E" } keys %emotes;     my @array = split /($smiley_re)/, $text;     for (@array) {         if (exists($emotes{$_})) {             $config{BuddyListPane1}->imageCreate('end', -image => $prepare_emotes{$emotes{$_}});         } else {             $config{BuddyListPane1}->insert('end', $_, 'text');         }     }