bh_perl has asked for the wisdom of the Perl Monks concerning the following question:
What happened to my program ? is it wrong ? As your information, I want to print out all the files in the specific directory.
But, after i test it the program did not print it correctly, All the files have been printed twice. As example :-
Could somebody tell me what wrong with my program ?TEST: EMSSIN_SR10_20061011115435.txt TEST: EMSSIN_VOIP_20061011115435.txt TEST: EMSSIN_SR10_20061011115435.txt TEST: EMSSIN_VOIP_20061011115435.txt
sub splitInputFile { my $cnt = shift; my $mscname = $swname[$cnt]; my $ftype = $outftype[$cnt]; my $ext = $outfext[$cnt]; my $indir = $inputdir[$cnt]; my $outdir = $outputdir[$cnt]; my $arcdir = $archivedir[$cnt]; if ( -d "$indir") { opendir(INDATA,$indir); while (my $indata = readdir(INDATA)) { next if $indata !~ /EMSSIN/; print "TEST: $indata\n"; } closedir(INDATA); } else { print "ERROR! $indir not found\n"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: READDIR: files printed twice in the directory ?
by BrowserUk (Patriarch) on Oct 11, 2006 at 07:40 UTC | |
|
Re: READDIR: files printed twice in the directory ?
by svenXY (Deacon) on Oct 11, 2006 at 07:43 UTC | |
|
Re: READDIR: files printed twice in the directory ?
by caelifer (Scribe) on Oct 11, 2006 at 15:07 UTC |