@array = ("12G","1G30G","13G24G"); $str = join '', @array; $str =~ s/[^G]//g; print length($str), "\n";