Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

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;

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://738608]
[james28909]: so if you subtracting as you loop, be aware that you will eventually be subtracting into a past month, or year <.<
[james28909]: dontcha love it!
[james28909]: Today would be scalar localtime. Yesterday would be scalar localtime - 1. sunday - monday would variate scalar localtime - ?
[james28909]: oops s/sunday - monday/sunday - saturday/
[james28909]: my mind is blown haha
[james28909]: hmm, i haz idea!

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (7)
As of 2017-04-29 03:57 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (531 votes). Check out past polls.