http://www.perlmonks.org?node_id=984096


in reply to needing to zip files in a series that begin with the same IP address

i feel im getting closer i failed to mention i need the output files to be the ip address e.g. 192.168.1.1.zip.

#!perl #use strict; use warnings; use IO::Compress::Zip qw(zip $ZipError) ; my @textfiles = <*.txt *.docx>; foreach my $textfile (@textfiles) { if ($textfile =~ /(\d+.\d+.\d+.\d+.*)/) { my $ip = $textfile =~ /(\d+.\d+.\d+.\d+).*/; my $files; push @{$files{$ip}}, $textfile; zip $textfile => $output or die "zip failed\n"; } }