[pm-h] write to empty files

Chris Blanc cblanc at dionysius.com
Fri Jun 8 17:18:08 PDT 2018


You may want a file with source file and target file names, two on
each line, separated by a tab.

Read that in, then go through a loop which reads from the source and
writes (as appropriate) to the targets.

On Fri, Jun 8, 2018 at 2:31 PM, Uri Guttman <uri at stemsystems.com> wrote:
> 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
> _______________________________________________
> Houston mailing list
> Houston at pm.org
> http://mail.pm.org/mailman/listinfo/houston
> Website: http://houston.pm.org/



-- 
http://www.dionysius.com/


More information about the Houston mailing list