use strict; use warnings; use utf8; use Encode qw/encode decode decode_utf8 encode_utf8 from_to/; my $instr = decode('utf8', ); if($instr =~ /(.*)[Cc](.*)[Hh](.*)[Ii](.*)[Ww](.*)[Aa](.*)[Ww](.*)[Aa](.*)/ ) { my $str = "$1$2$3$4$5$6$7$8"; print length($str); } else { print -1; }