DeusVult has asked for the wisdom of the Perl Monks concerning the following question:
./dir1/foo/bar.txt
./dir2/foo/bar.txt
./dir3/foo/bar.txt
etc.
I need to make the same modification to every copy of bar.txt. My plan was to find a way to make an array dirList such that its contents were equal to ( dir1 dir2 dir3 ... ). Therefore I could just say
My only problem is I don't know how to create @dirList. Any help would be appreciated.foreach my $dir ( @dirList ) { open ( FILE, "$dir/foo/bar.txt" ) or die ("nasty message: $!"); while (<FILE>) { &doStuff(); } }
Some people drink from the fountain of knowledge, others just gargle.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Opening every directory in the current directory
by japhy (Canon) on Feb 10, 2001 at 02:39 UTC | |
by runrig (Abbot) on Feb 10, 2001 at 02:53 UTC | |
Re: Opening every directory in the current directory
by runrig (Abbot) on Feb 10, 2001 at 02:42 UTC | |
Re: Opening every directory in the current directory
by footpad (Abbot) on Feb 10, 2001 at 08:28 UTC |