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.
--chargrill
s**lil*; $*=join'',sort split q**; s;.*;grr; &&s+(.(.)).+$2$1+; $; =
qq-$_-;s,.*,ahc,;$,.=chop for split q,,,reverse;print for($,,$;,$*,$/)
| [reply] [d/l] [select] |
use strict;
use warnings;
my $str = 'mASVKSSSSSSSSSFISLLLLILLVIVLQSQVIECQPQQSCTASLTGLNVCAPFLVPGS
+PTASTECCNAVQSINHDCMCNTMRIAAQIPAQCNLPPLSCSANSSS';
$str =~ s/(.{10})/$1 /g;
$str =~ s/(S{3,})/<font color=red>$1<\/font>/g;
$str =~ s/<\/font> <font color=red>/ /g;
print $str;
__END__
Output is:
----------
mASVK<font color=red>SSSSS SSSS</font>FISLLL LILLVIVLQS QVIECQPQQS CTA
+SLTGLNV CAPFLVPGSP TASTECCNAV QSINHDCMCN TMRIAAQIPA QCNLPPLSCS AN<fon
+t color=red>SSS</font>
Look into this How (Not) To Ask A Question
chargrill++
Regards, Velusamy R. eval"print uc\"\\c$_\""for split'','j)@,/6%@0%2,`e@3!-9v2)/@|6%,53!-9@2~j';
| [reply] [d/l] [select] |
Tony1,
This looks very similar to your previous post color a letter in an array. Was there anything covered in the replies to your previous question that you did not understand?
Martin | [reply] |
Hi Tony1,You've asked a very similar question here before. What didn't you understand about the advice you were given before when looking at this new problem? You still seem to be confusing strings and arrays. Perhaps you should take a little time to read perldata which will explain Perl's different data types.
Cheers, JohnGG | [reply] |