use IO::Compress::Gzip qw(gzip); use IO::Uncompress::Gunzip qw(gunzip $GunzipError); my $data = 'I include only the bare bones because I tried something'; # Create some compressed data my $gzipped ; gzip \$data => \$gzipped ;