in reply to Code optimization help and troubleshooting
My HTML-fu is nil, but as to coloring the last 1-10 characters in a string blue and all preceding characters red, the following might be useful. It seems to work if I re-direct to a x.html file and look at it in IE. I leave to you putting the <br/> tags where you want them and other such trivial details.
c:\@Work\Perl\monks>perl -wMstrict -le "my $red = '<span style=\"color:red\">'; my $blue = '<span style=\"color:blue\">'; my $post = '</span>'; ;; my $bases = qr{ [ATCG] }xms; ;; for my $s (qw( GGCGCAACGCTGAGGCCCCAGTTCTGCGCAGCTGCAGGGCATT ATCGATCGATC ATCGATCGAT A )) { my $seq = $s; $seq =~ s{ ($bases{1,10} \z) }{$blue$1$post}xms; $seq = qq{$red$seq$post}; print $seq; } " <span style="color:red">GGCGCAACGCTGAGGCCCCAGTTCTGCGCAGCT<span style=" +color:blue">GCAGGGCATT</span></span> <span style="color:red">A<span style="color:blue">TCGATCGATC</span></s +pan> <span style="color:red"><span style="color:blue">ATCGATCGAT</span></sp +an> <span style="color:red"><span style="color:blue">A</span></span>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Code optimization help and troubleshooting
by AnomalousMonk (Archbishop) on Oct 06, 2014 at 22:09 UTC |