#!/usr/bin/perl use warnings; use strict; use IO::Uncompress::Unzip; sub walk { my $name = shift; my $fh = shift; my $indent = shift // 0 ; $indent += 2; my $unzip = new IO::Uncompress::Unzip $fh, or die "Cannot open zip\n" ; my $status; for ($status = 1; $status > 0; $status = $unzip->nextStream()) { my $name = $unzip->getHeaderInfo()->{Name}; warn " " x $indent . "Processing member $name\n" ; if ($name =~ /.zip$/) { walk($name, $unzip, $indent); } else { # Deal with the payload here my $buff; while (($status = $unzip->read($buff)) > 0) { # Do something here print "$buff\n"; } } last if $status < 0; } die "Error processing $name: $!\n" if $status < 0 ; } my $file = shift; my $fh ; open $fh, "<$file" ; warn "Processing zip file $file\n"; walk($file, $fh);