I have a slight problem which is probably easy to fix, but I am still fairly new to this language. Firstly, I shall show you the code:
Expand|Select|Wrap|Line Numbers
- #!/usr/bin/perl
- opendir(DIR, "directory") || die "Cannot open directory";
- my @file = readdir(DIR);
- closedir(DIR);
- open(NF, ">file" || die "Cannot open file");
- foreach my $file (@file)
- {
- @file = sort(@file);
- open(FH, $file) or die "$!";
- while (<FH>)
- {
- if ((/Jan-\d\d/) || (/Feb-\d\d/) || (/Mar-\d\d/) || (/Apr-\d\d/) || (/May-\d\d/) || (/Jun-\d\d/) || (/Jul-\d\d/) || (/Aug-\d\d/) || (/Sep-\d\d/) || (/Oct-\d\d/) || (/Nov-\d\d/) || (/Dec-\d\d/))
- {
- chomp;
- print NF "$_\n";
- }
- }
- }
- close(NF);
- close(FH);