in reply to Re: number of numbers in a string
in thread number of numbers in a string
But y/// (aka tr///) is the perfect-fit tool for this job.# or: ++$count while $foo =~ /\d/g; # or: $count = $foo =~ s/(\d)/$1/g; # or: $count = () = $foo =~ /\d/g; # or: $foo =~ s/(\d)/++$count; $1/ge; # etc.
Update: s/gee/ge/; thanks, japhy; yes, a typo
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: number of numbers in a string
by japhy (Canon) on Aug 12, 2004 at 18:33 UTC |