"Counting whitespace" doesn't make much sense. Did you mean "counting whitespace characters"?
/^(\s*)/ && length($1)
Update: Presuming a scalar context,
() = /\G\s/g
also works.
In reply to Re: counting leading white spaces
by ikegami
in thread counting leading white spaces
by Spooky
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |