my $z = IO::Uncompress::Unzip->new($input, AutoClose=>1) or die "IO::Uncompress::Unzip failed: $UnzipError\n"; while (<$z>) { # ... }