[pm-h] write to empty files

Uri Guttman uri at stemsystems.com
Fri Jun 8 11:01:50 PDT 2018


On 06/08/2018 01:48 PM, rlharris at oplink.net wrote:
> On Fri, June 8, 2018 12:20 pm, Uri Guttman wrote:
>
>> use File::Slurp ;
>> write_file( 'filename', "header text\n" ) ;
>> append_file( 'filename', "more text\nand even more\n" ) ;
> Thanks, Uri; this is what I hoped to find!
>
> But my knowledge of Perl is rusty; I do not recall what structure is
> needed to feed to this code a list of filenames, such as:
>
>    foobar-01.tex
>    foobar-02.tex
>    foobar-03.tex
>    ...

i am not sure what you want but here is my guess

my @files = qw( foobar-01.tex foobar-02.tex foobar-03.tex) ;

foreach my $tex_file ( @files ) {

         write_file( $tex_file, "tex header\n" ) ;
}

learning perl should cover that just fine

uri

   ...


More information about the Houston mailing list