in reply to binmode html encoding

You probably can get away with tieing the filehandle with Tie::Handle. Here's an example:

package html; require Tie::Handle; @ISA = qw/Tie::Handle/; use HTML::Entities; sub TIEHANDLE { return bless({}, shift); } sub PRINT { untie *STDOUT; print encode_entities(join "", @_); tie *STDOUT, "html"; } package main; tie *STDOUT, "html"; print "foo & bar\n";

It might need some work to plug cleanly in whatever code you need to write.

--
Leviathan.