#!/usr/bin/perl -Tusestrict;usewarnings;useCGI::Carpqw(fatalsToBrowser);useCGIqw/:standard/;my$cgi=newCGI;print$cgi->header;useSyntax::Highlight::Perl;my$color_table={"Variable_Scalar"=>"vs","Variable_Array"=>"va","Variable_Hash"=>"vh","Variable_Typeglob"=>"vt","Subroutine"=>"sub","Quote"=>"qr","String"=>"str","Comment_Normal"=>"cm","Comment_POD"=>"cmp","Bareword"=>"bw","Package"=>"pk","Number"=>"nb","Operator"=>"op","Symbol"=>"sym","Keyword"=>"kw","Builtin_Operator"=>"bo","Builtin_Function"=>"bf","Character"=>"char","Directive"=>"dr","Label"=>"lb","Line"=>"ln",};my$formatter=Syntax::Highlight::Perl->new();$formatter->define_substitution("<"=>"<",">"=>">","&"=>"&");# HTML escapes.# install the formats set up abovewhile(my($type,$class)=each%{$color_table}){$formatter->set_format($type,[qq~<span class="$class">~,"</span>"]);}printqq~<link rel="stylesheet" href="highlightperl.css" type="text/css" />~;print"<pre>";while(<DATA>){print$formatter->format_string;}print"</pre>";数据挖掘工具