in reply to foreach not working as I expected
Put the actions you want to do to the file inside the loop. And don't forget to close the file when done.
#!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: $!" ; print ADDTO $txt; #Write the text close ADDTO; } print "Done\n\n" ; #Let the user know it is done
--- print map { my ($m)=1<<hex($_)&11?' ':''; $m.=substr('AHJPacehklnorstu',hex($_),1) } split //,'2fde0abe76c36c914586c';
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: foreach not working as I expected
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 |