Hi, diamondsandperls.
You're certainly not clueless, as you've mostly done this work yourself.
Sorry, but I didn't mean to confuse the issue by using __DATA__, but it was for example only (gives a source of the data for the script). So, you can use what you've already done like this:
use Modern::Perl; use IO::Compress::Zip qw(zip $ZipError) ; my %files; my @files = <*.txt *.docx>; for (@files) { next unless /^(\d+.\d+.\d+.\d+)/; push @{ $files{$1} }, $_; } for my $ip ( keys %files ) { do { print "Zip $ip -> $_" } for @{ $files{$ip} }; }
Place your zipping call within the do{} block (replacing the printing placeholder), noting that $ip contains the common IP address and $_ contains the complete file name to be zipped.
ps Modern::Perl contains both strict and warnings.
In reply to Re^5: needing to zip files in a series that begin with the same IP address
by Kenosis
in thread needing to zip files in a series that begin with the same IP address
by diamondsandperls
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |