use strict; use warnings; my $mail = 'xqwertyxyx@gmail.com'; my $count = ($mail =~ tr/x/x/); print "$count\n";