The Encode::Guess documentation shows pieces of working code in the synopsis. I used it that way, and it worked for me (with utf-8, ISO-8859-1 and a few others, can't recall exactly).
If you have more specific requirements, you need more specific code. But we don't know about any of these, so we can't help you. Sorry.