Lossy text compression in Perl