use strict; use warnings; use IO::Compress::Zip qw(:all); { my $zip = new IO::Compress::Zip "/tmp/my.zip", Name => "foo/bar.txt" or die "Cannot create zip file : $ZipError\n" ; print $zip "hello world" ; } # Check the zip file was created system "unzip -l /tmp/my.zip" ;