I have written this script to search for text payment files in a folder and copy their contents into 1 file which i can now process to xml format. I have no clue how to create a correct XML file out of that in PErl Please help.
($weg, $weg, $weg, $today_day, $today_month, $today_year) =localtime; $today_month++; if ($today_day < 10) {$today_day="0"."$today_day"}; if ($today_month < 10) {$today_month="0"."$today_month"}; if ($today_year >= 100) {$today_year=$today_year-100;$century=20}; if ($today_year < 10) {$today_year="0"."$today_year"}; $filename = $today_day.$today_month.'_'; $outfile =$input_directory."payment.txt"; opendir (DIR,$input_directory); @allfiles = readdir(DIR); closedir(DIR); $filecounter = 0; open(OUTFILE, ">".$outfile); foreach $file (@allfiles) { if($file =~ /$filename/) {print "$file\n"; $filecounter++; open(IN,"<".$input_directory.$file); while (@values = <IN>) { print OUTFILE @values; } } } print "A Total of $filecounter bis payment files found in $input_direc +tory\n"; exit 1 if ($filecounter eq 0); close(OUTFILE); make_bis(); }#end of init_proc sub make_xml_sepa { $open_filename = $input_directory."bisfile.txt"; while (!open(IN, $open_filename) &amp;&amp; $open_filename ne "q" &amp;&amp; $open_filename ne "Q") { print "File ",$open_filename," not found.\n"; print "Please enter alternative filename (q quits): "; $open_filename=<STDIN>; chop ($open_filename); print "\n"; }; exit if ($open_filename eq "q" || $open_filename eq "Q"); open(IN, $open_filename); #Make output filename $output_filename = $output_directory."BIS_".$today_year.$today_month.$ +today_day.sprintf("%2.2d",$nummer).".txt"; $record_number++; $totalaccountno = $own_account_no + $holder_acc_no; # total accou +nt number $amount_running =$amount; # total amoun +t if ($record_number > 100) { print "Warning: not all payments could be processed, since\n"; print " there are not sufficient file names available.\n"; } $output_filename = ">".$output_directory."BIS_".$today_year.$today_m +onth.$today_day; $output_filename = $output_filename.sprintf("%2.2d",$nummer+$record_ +number); $output_filename = $output_filename.".txt"; open (OUT,$output_filename); PAYMENT: while ($_ = <IN>) { #main loop #capitalize everything +! ( $cstcntr, $bankacct, $value_date, $dealcode, $amount, $linkcode, $flowtype) = split(/$list_seperator/, $_); last if ($bankacct eq "" || $amount eq "");

In reply to Text file CSV to SEPA xml format by TevaMoon

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.