There are several ways to do syntax-highlighting of various kinds of code/scripts/etc, and output the color-highlighted text as HTML.
vim -f +'syntax on | let html_use_css = 1 | source $VIMRUNTIME/syntax/2html.vim | write | qall" yourfall.pl
% ls /usr/share/enscript/hl/*.st enscript.st describe_languages.st default_faces.st style_emacs.st style_emacs_verbose.st style_ifh.st style_a2ps.st style_msvc.st lang_ansi.st lang_enscript.st lang_html.st lang_overstrike.st lang_rtf.st lang_texinfo.st ada.st asm.st awk.st bash.st c.st c_comment.st c_ppline.st c_string.st changelog.st cpp.st csh.st delphi.st diff.st diffs.st diffu.st elisp.st fortran.st fortran_pp.st haskell.st html.st idl.st inf.st java.st javascript.st ksh.st m4.st mail.st makefile.st matlab.st nroff.st objc.st outline.st pascal.st passthrough.st perl.st postscript.st python.st pyrex.st rfc.st scheme.st sh.st skill.st sql.st states.st synopsys.st tcl.st tcsh.st tex.st vba.st verilog.st vhdl.st vrml.st wmlscript.st zsh.st