[pm-h] write to empty files

Uri Guttman uri at stemsystems.com
Fri Jun 8 12:31:12 PDT 2018


On 06/08/2018 02:55 PM, rlharris at oplink.net wrote:
> On Fri, June 8, 2018 1:01 pm, Uri Guttman wrote:
>> my @files = qw( foobar-01.tex foobar-02.tex foobar-03.tex) ;
>>
>> foreach my $tex_file ( @files ) {
>>
>>          write_file( $tex_file, "tex header\n" ) ;
>> }
> I may have as many as a thousand "foobar-xx.tex" files.  There must be
> a way to give "my @files" the name of a file containing target
> filenames.  Is this something covered in "Learning Perl" ?
> _______________________________________________

File::Slurp to the rescue again!

my @lex_files = read_file( 'file_with_tex_names' ) ;
chomp @lex_files ;

done!

uri


More information about the Houston mailing list