sowais has asked for the wisdom of the Perl Monks concerning the following question:
use strict; use warnings; my $directory = 'C:\test'; chdir($directory) or die "Can't chdir to $directory $!"; opendir(DIR, $directory) || die "Couldn't opendir: $!\n"; my @files = grep(/\.matched$/, readdir(DIR)); my $destdir = 'C:\test'; if (@files) { foreach(@files){ print $_, "\n";} open COMBINED, '+>>', "$destdir/combined.matched" or die "Can't op +en file, combined.matched: $!"; foreach(@files){ open MATCHED, '<', "$_" or die "Can't open file, $_: $!"; while(<MATCHED>){ print COMBINED "$_";} close MATCHED; } close COMBINED; } unlink(@files); close $directory; exit 0;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Need help with unlink error
by zentara (Cardinal) on Aug 11, 2011 at 16:26 UTC | |
|
Re: Need help with unlink error
by toolic (Bishop) on Aug 11, 2011 at 16:50 UTC | |
|
Re: Need help with unlink error
by jethro (Monsignor) on Aug 11, 2011 at 16:29 UTC | |
|
Re: Need help with unlink error
by cdarke (Prior) on Aug 12, 2011 at 08:45 UTC | |
|
Re: Need help with unlink error
by Anonymous Monk on Aug 11, 2011 at 17:08 UTC |