in reply to coloring patterns of an array
First, that looks like a scalar to me, not an array. An array looks like this in perl:
@array = ( 'M', 'A', 'S', 'K', ...);
Second, what have you tried?
I immediately think to use a regular expression, wherein I would match 3 or more repeating 'S' characters, capture that match, and surround the match by your font tags in the right hand side of said regular expression.
Look into s/// in "Regexp quote-like operators" at perlop. In particular, pay attention to the use of capturing parenthesis (), the special $1 backreference variable, the {} quantifiers (specifically look for "Match at least n times"), and the /g global modifier.
After you've given it an effort, and if you're still having trouble, let us know - we'll be happy to help.
Update: Taking a second look, you'll also need to decide if you want to add spaces, as you have in your example, or whether that was a typo.
s**lil*; $*=join'',sort split q**; s;.*;grr; &&s+(.(.)).+$2$1+; $; = qq-$_-;s,.*,ahc,;$,.=chop for split q,,,reverse;print for($,,$;,$*,$/)
|
|---|