Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
foreach $arrFileList(@arrFileList) { print "I am doing this file $arrFileList\n"; open (FILE, "$sourceDir/$arrFileList") or die "could not open $sour +ceDir/$arrFileList: $!\n"; @Lines = <FILE>; close FILE; $origField = (split /\|/, $Lines[3])[-3]; $commonField = (split /\|/, $Lines[13])[-1]; $commonField = "NX2|01|$commonField"; chomp $commonField; print "my commonField is this $commonField\n"; @ARGV = <$responseDir/*>; while (<>) { $newFile = $ARGV, last if /^"$commonField"$/; } print "my newFile to change is $newFile\n"; if (defined($newFile)) { system ("perl -pi -e 's/$replaceField/$origField/g' $newFile"); print "Done doing perl s/$replaceField/$origField/g $newFile\n"; system ("mv $newFile $responseDone"); print "Done moving $newFile to $responseDone\n"; system ("mv $sourceDir/$arrFileList $processed"); print "Done moving $sourceDir/$arrFileList to $processed\n"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Help on foreach loop
by Roy Johnson (Monsignor) on Sep 09, 2004 at 15:15 UTC | |
by Anonymous Monk on Sep 09, 2004 at 15:32 UTC | |
by Roy Johnson (Monsignor) on Sep 09, 2004 at 15:53 UTC | |
|
Re: Help on foreach loop
by Random_Walk (Prior) on Sep 09, 2004 at 15:01 UTC | |
|
Re: Help on foreach loop
by ysth (Canon) on Sep 09, 2004 at 15:48 UTC | |
by Anonymous Monk on Sep 09, 2004 at 16:01 UTC | |
by ysth (Canon) on Sep 09, 2004 at 16:05 UTC | |
by Anonymous Monk on Sep 09, 2004 at 17:24 UTC | |
by Not_a_Number (Prior) on Sep 09, 2004 at 17:45 UTC | |
| |
|
Re: Help on foreach loop
by Prior Nacre V (Hermit) on Sep 09, 2004 at 14:46 UTC | |
by Anonymous Monk on Sep 09, 2004 at 14:55 UTC | |
|
Re: Help on foreach loop
by jockel (Beadle) on Sep 09, 2004 at 15:05 UTC | |
by Anonymous Monk on Sep 09, 2004 at 15:07 UTC | |
by Mr. Muskrat (Canon) on Sep 09, 2004 at 23:57 UTC | |
by Your Mother (Archbishop) on Sep 10, 2004 at 05:27 UTC |