in reply to decompressing the string

I think you misunderstood the [, $level] part of the docs: it's intended to mean that the ", 1" part is optional. As you wrote it it simply won't compile.

syntax error at test.pl line 3, near "[," Execution of test.pl aborted due to compilation errors.
Try this:
use Compress::Zlib; my $str_to_compress='a big string'; $compressed_str=compress($str_to_compress,1); $decompressed_str=uncompress($compressed_str); print $decompressed_str;

By the way, please note exact error message text next time. Paraphrasing errors will only confuse people.