while ($string =~ /./gs) {
# whatever with $&
# note that this incurs the penalty for using $&
}
You can avoid the $& penalty by using parentheses:
/(.)/gs and using the $1 variable.
Arjen
In reply to Re: Re: foreach (each character in string..)?
by Aragorn
in thread foreach (each character in string..)?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |