http://www.perlmonks.org?node_id=1101565


in reply to bold color text and export to file

color output was difficult to save in text file

You can do it. It depends of the desired output format... want a yummy pdf?

my $dna = "AAAAAACAAACAAACCCAATATATATATACGACATATATTATATATTATACCCCGGG"; my $preciouss = substr $dna, 15, 28; open (my $output, '>', "latex_file.tex"); print $output "\\documentclass{article}\n\\usepackage{color}\n"; print $output "\\begin{document}\n"; print $output "THIS IS MY BORING GENE: \\textcolor{red}{", $preciouss, + "}\\\\\\textcolor{blue}{OKAY, OKAY... \\textit{NOT SO BORING}, {\\bf + IS RED!}}"; print $output "\n\\end{document}"; close $output; system("pdflatex latex_file.tex"); system("xpdf latex_file.pdf &");

You will need to have installed a decent tex distro and xpdf. See texlive. You can also translate to html, dvi or postscript easily from here, as you will

Update: typo fixed in textit and new link