Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
my $caseNumber = $ARGV[0]; my $pattern = "(.*?)$caseNumber(.*?)"; my $count = 0; my @uploads; my @files; ##Open logfiles directory and read into array. opendir DIR, "Directory" or die "Unable to open Directory, please try +again"; @files = readdir(DIR) or die "Unable to read directory"; closedir DIR; ##Loop though the files and if the pattern matches, push it into the a +rray. foreach (@files) { if (/$pattern/) { push @uploads,$_; } }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Is there a better way.
by Roy Johnson (Monsignor) on Feb 23, 2009 at 22:42 UTC | |
by Anonymous Monk on Feb 23, 2009 at 22:49 UTC | |
by afresh1 (Hermit) on Feb 25, 2009 at 21:34 UTC | |
Re: Is there a better way.
by ig (Vicar) on Feb 23, 2009 at 23:42 UTC | |
Re: Is there a better way.
by Illuminatus (Curate) on Feb 23, 2009 at 22:57 UTC | |
by jwkrahn (Abbot) on Feb 23, 2009 at 23:44 UTC | |
by Lawliet (Curate) on Feb 24, 2009 at 01:47 UTC | |
by graff (Chancellor) on Feb 24, 2009 at 03:28 UTC | |
by jwkrahn (Abbot) on Feb 24, 2009 at 03:21 UTC | |
by k0d3Monkee (Initiate) on Feb 25, 2009 at 00:08 UTC | |
Re: Is there a better way.
by ysth (Canon) on Feb 24, 2009 at 03:18 UTC | |
Re: Is there a better way.
by tokpela (Chaplain) on Feb 24, 2009 at 09:41 UTC |