$item=”heat741a”; #for the sake of the example I fixed the variables $OrderQty = 55; open(LOG, ">order.xml") || die "Can't open the log file: $!\n"; $format = "format LOG = \n" . "\<\?xml version\=\"1\.0\"\?\>" . "\n" . "\" ."\n" . "\" .'@' . '<<<<<<' . "\<\\product\>" . "\n" . '$item' . "\n" . "\" .'@' . '<' x (length($OrderQty)-1) . "<\\quantity>" . "\n" . '$OrderQty' . "\n" . "\<\\order\>" ."\n" . ".\n"; eval $format; write LOG; close LOG;