#!perl #perl write test 2 use diagnostics; use strict; use warnings; # creating the txt file my $data_file = 'h:\\data.txt'; open example, "$data_file" or die "can't open $data_file $!"; #write to the file while ($data_file){ print " test "; } close (example);