This code should work but it does not, any suggestions? 

All I need is to create a temporary file to store some data so I can
stuff it into
another application and then trash it.  I thought it would be easy.


use utf8;
use IO::Handle;
#use File::Copy;
use File::Temp qw /tempdir tempfile /;
$dir = tempdir (CLEANUP => 1);
($fh, $filename) = tempfile( DIR => $dir);
$template = "STARrequestXXXXXX";
($fh,  $filename) = tempfile($template, DIR => $dir, SUFFIX => ".xml");
print "FILENAME: $filename\n";
#$fh->print("FILENAME: $filename\n");
$fh->print(" <?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n");
$fh->print(" <Root>\n");
       $fh->print(" <GetSTARXMLInfo/>\n");
       $fh->print(" <Quit/>\n");
$fh->print(" </Root>\n");
#copy($filename, "StarRequest.txt");
open (TEMPFILE , $filename) || die "Error: $!\n";
while(<TEMPFILE>) {
       print $_;
}
$fh->close();
#sleep(10);

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to