#!/usr/bin/perl # Look at the (sub xmlrow), here again you are creating # scalars (my $ostar="${$colname}$estar$colname\>\n"; # Note the backslash to escape the > of the closing tags. # # However; The call to print as you have written it will be # much faster, and use less memory. So if you are not going to # modify this any further, get rid of the scalars. ## UPDATE ## How about using INFILE and OUTFILE for your ## filehandles instead to avoid ## any problems within the world of Perl. ## Or, FILE1 FILE2 #this is the out from the previous script $IN = "someFileName.txt"; $OUT = "someOutFile.xml"; open (OUT, ">$OUT"); open(IN) or die ("Cannot open file ($IN)"); print OUT < TOP $id = 0; @columns = (category,id,code,title,summary,prereq,group,subgroup,sequence,rolemandatory,rolerecommended,roleoptional,url,modality,"length"); foreach $row (){ ($category,$code,$title,$summary,$prereq,$group,$subgroup,$sequence,$rolemandatory,$rolerecommended,$roleoptional,$url,$modality,$length) = split ('\|', $row); print OUT "\n"; foreach $_ (@columns){ &xmlrow($_); } print OUT "\n"; $id++; } print OUT "\n"; sub xmlrow{ my $colname = shift(@_); my $ostar="${$colname}\n"; } 1; #added to tell Perl that the file has been completely read and "use" or "require" has been fulfilled