There are many ways, here is one that does not involve an array
my $str = 'paul cotter';
print $1,$1 while ( $str =~ /^(.)/g );
The above prints ppaauull ccootttteerr (just to show it is printing 1 at a
time - twice).
It is going therough $str one character at a time seeing if it matches "."
which means any character. So it is throwing away newlines. We can keep
the newlines with
print $1,$1 while ( $str =~ /^(.)/gs );
> Hello. I am attempting to print a string one character at a time. Right
now I am using one while loop with chop to create a new string, the reverse
of the original string, then another while loop with chop on the reversed
string to print out the characters. I'm sure there's a more
straight-forward way of doing this - any ideas?