in reply to Which is more faster? While or tr///

Does this makes my program little slow?

You tell us. If you can't tell, does it matter?

Here are some clean implementations:

$count += ($tbsz*0.7844) while $string =~ /W/g;
$count += ($tbsz*0.7844) * ( () = $string =~ /W/g );
$count += ($tbsz*0.7844) * ( $string =~ tr/W// );