ellem has asked for the wisdom of the Perl Monks concerning the following question:
This is the code:12/18/2002 11:02a <DIR> . 12/18/2002 11:02a <DIR> .. 12/18/2002 11:06a 444 addtext.pl 12/18/2002 09:02a 0 Fiduciary_Group.txt 12/18/2002 09:02a 0 Nationwide_Group.txt 12/18/2002 09:02a 0 Relius_Group.txt 12/18/2002 09:02a 0 Sales_Group.txt 12/18/2002 11:02a 74 WordProcessing_Group.txt
My script only seems to be working on one file, the one with 74 bytes, but (shamefully) I don't know why.#!C:\Perl\bin\perl.exe #Lou M 121702 @ GW use warnings ; use diagnostics ; use strict ; my $txt = "Windows 2000 SP3\nWindows Office XP\n" ; foreach my $file (<*.txt>) #For Each .txt file #in the directory #this script runs from { open ADDTO, ">> $file" or die "Can't open file: $!" ; } #Open all the .txt files #for appendding print ADDTO $txt; #Write the text print "Done\n\n" ; #Let the user know it is done
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: foreach not working as I expected
by Tanalis (Curate) on Dec 18, 2002 at 16:55 UTC | |
by Jenda (Abbot) on Dec 18, 2002 at 22:18 UTC | |
|
Re: foreach not working as I expected
by pfaut (Priest) on Dec 18, 2002 at 16:55 UTC | |
by chromatic (Archbishop) on Dec 18, 2002 at 18:09 UTC | |
by pfaut (Priest) on Dec 18, 2002 at 18:15 UTC | |
by mce (Curate) on Dec 19, 2002 at 15:25 UTC | |
|
Re: foreach not working as I expected
by pg (Canon) on Dec 19, 2002 at 05:49 UTC | |
by {NULE} (Hermit) on Dec 19, 2002 at 17:32 UTC | |
|
Re: foreach not working as I expected
by Anonymous Monk on Dec 19, 2002 at 16:24 UTC |