Looking at merlyn's Forcing list context, the above can be simplified as:$foo = "spider9832man23"; my @digits = ($foo =~ /\d/g); print scalar(@digits); # print 6
$foo = "spider9832man23"; print ( $count = () = $foo =~ /\d/g); # prints: 6
In reply to Re: number of numbers in a string
by johnnywang
in thread number of numbers in a string
by concept03
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |