Check out PerlIO.
the lowliest monk
In reply to Re: Saving Encoded Text by tlm in thread Saving Encoded Text by Anonymous Monk