sub unzipScalar { my $filename = shift; my $SH = shift; my $zip = Archive::Zip->new(); $zip->readFromFileHandle( $SH ); return $zip->contents($filename); } # caller: my $content = getFile ($ua, $fileURI); my $tfh = IO::File->new_tmpfile or die "Unable to make new temporary file: $!"; $tfh->print ($content); $tfh->seek (0, 0); my $unzipped = unzipScalar ($filename,$tfh);