chanakya has asked for the wisdom of the Perl Monks concerning the following question:
Thanks in advance#!/usr/bi/perl $driver = "./dirlist.csv"; open DRV , $driver || die "Cannot open $driver: $!"; while( <DRV> ){ chomp; my ($dirname) = shift; checkExistingDates($dirname); } close DRV; sub checkExistingDates{ my $dirname = shift; my @datelist = ("20030901", "20061017", "20050406", "20070101", "2 +0080202"); #the file list should be read from the $dirname, for testing using + hard values my @fileslist = ("DIR22.20060816", "DIR22.20050919", "DIR22.200610 +17", "DIR22.20060516", "DIR22.20050406"); my @matched; foreach my $date (@datelist}){ @matched = grep{$date} @fileslist; } print Dumper @matched; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Grepping arrays, any better way to do this?
by bart (Canon) on Feb 15, 2007 at 11:15 UTC | |
|
Re: Grepping arrays, any better way to do this?
by izut (Chaplain) on Feb 15, 2007 at 11:17 UTC | |
|
Re: Grepping arrays, any better way to do this?
by akho (Hermit) on Feb 15, 2007 at 11:44 UTC | |
|
Re: Grepping arrays, any better way to do this?
by chanakya (Friar) on Feb 15, 2007 at 14:05 UTC | |
by 5mi11er (Deacon) on Feb 16, 2007 at 23:00 UTC |