my @chars = split(//, $string);
When you call split with an empty pattern "//", it automatically splits into individual characters and returns that list of characters.
To print the results out as you have, then do this...
print join("\n", split(//, $string)), "\n";
The split() works as I stated above.
The join takes each element of the list it is given in the second arguement and puts the first arguement after it, forming a string; Exception, then last item in the list does not get the first arguement appended to it -- that is why I added the last "\n". |