in reply to Counting number of characters in a string
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")
|
---|
Replies are listed 'Best First'. | |
---|---|
(tye)Re2: Counting number of characters in a string
by tye (Sage) on Mar 13, 2001 at 02:54 UTC |