my $count= 0; for(0..255){ my $c= pack "C", $_; $count += () = $str =~ /\Q$c\E/g; }
Warning! This probably yields an inaccurate count for Unicode strings.
- tye (but my friends call me "Tye")In reply to (tye)Re: Counting number of characters in a string
by tye
in thread Counting number of characters in a string
by jeffpflueger
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |