Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^4: Counting number of characters in a string

by ikegami (Pope)
on Jan 23, 2009 at 22:34 UTC ( #738608=note: print w/ replies, xml ) Need Help??


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;


Comment on Re^4: Counting number of characters in a string
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://738608]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (8)
As of 2015-05-24 14:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    In my home, the TV remote control is ...









    Results (473 votes), past polls