According to perldoc perldata (paragraph for $MATCH) I would avoid the use of "$&"; I would capture the pattern and use "$1" instead.
But usually I prefer the split() solution.use strict; use warnings; my $string = "Hello World"; while($string =~/(.)/g){ print "$1\n"; }
In reply to Re^2: How to get each character in string value
by linuxer
in thread How to get each character in string value
by dharanivasan
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |