in reply to Re^3: Counting number of characters in a string
in thread Counting number of characters in a string
Remove the backslash, add the "s" modifier. And the parens aren't necessary.
my $cnt = @{[$str =~ /./sg]};
Cheaper alternative:
my $cnt =()= $str =~ /./sg;
|
---|
In Section
Seekers of Perl Wisdom