in reply to Re^3: needing to zip files in a series that begin with the same IP address
in thread needing to zip files in a series that begin with the same IP address
man im clueless on this i know how to regex for my file list just not sure how to apply to the code you gave.
#!perl use strict; use warnings; use Modern::Perl; use IO::Compress::Zip qw(zip $ZipError) ; my %files; while (<DATA>) { next unless /^(\d+.\d+.\d+.\d+)/; push @{ $files{$1} }, $_; } for my $ip ( keys %files ) { do { print "Zip $ip -> $_" } for @{ $files{$ip} }; } __DATA__ my @files = <*.txt *.docx>;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^5: needing to zip files in a series that begin with the same IP address
by Kenosis (Priest) on Jul 27, 2012 at 22:07 UTC | |
by diamondsandperls (Beadle) on Jul 27, 2012 at 22:32 UTC | |
by Kenosis (Priest) on Jul 27, 2012 at 22:55 UTC |
In Section
Seekers of Perl Wisdom