how to process each character in a string?

by Nithya 2010-02-04 14:04:04

If you want to put each character from your string into an array (and presumably work on them some more), you'd take an approach like this:

# our string
$string = 'Four score and seven years ago our fathers';

# split the string into an array of characters
@array = split(//, $string);

# print the contents of our perl array
print "@array";

Tagged in:

979
like
0
dislike
0
mail
flag

You must LOGIN to add comments