Browse - programming tips - perl split string into charactersDate: 2011jul7 Language: perl Q. How do I split a string into characters so I can look at each one? A. Use split() with // as the pattern. For example: $str = 'hello'; for $c (split(//,$str)) { print "c=$c\n"; } However, usually in perl its is better to use pattern matching to find something in a string.
Add a commentSign in to add a comment | Advertisements:
|