http://www.perlmonks.org?node_id=986083


in reply to Batch to Perl translation (just 1 line, not the whole script)

open my $fh, ">>", $ARGV[0] || die "$0: $ARGV[0]: $!\n"; # open the file specified in the first argument in append mode print $fh q{BAYES; bayesClass=nameOfClassVariable; END}; # write the text; close $fh; # close the file;
See open, print, Quote and Quote like Operators, close for more information.
Sorry if my advice was wrong.