http://qs321.pair.com?node_id=889217

lingaraj has asked for the wisdom of the Perl Monks concerning the following question:

sub http_fetch { my $tmp_file = $_[0]; my ( $http_fetch_file ) = $_[1]; my @tmp_content = (); #----------------------------------------------------------------- +-----------------------------------------------HTTP Fetch require LWP::UserAgent; my $ua = LWP::UserAgent->new; $ua->timeout(80); #$ua->show_progress(1); #$ua->agent('Mozilla/4.0 (compatible; MSIE 5.0; Windows 95)'); #$ua->proxy(["http"], "http://proxy.msat:80"); #$ua->env_proxy; eval { my $response_hash = $ua->get($tmp_file); open(HTMLFH,">$http_fetch_file"); print HTMLFH $response_hash->content; close(HTMLFH); }; if ($@) { print "HTTP Error\n"; } #----------------------------------------------------------------- +----------------------------------Load Content Into Array else { open(HTMLFH, $http_fetch_file); @tmp_content = <HTMLFH>; close(HTMLFH); } return @tmp_content; } .... ... ... ... ... .... .... open XMLFH ,">:utf8","$record{Curr_XML_File}"; print XMLFH $final_content; close XMLFH;
print in terminal it's printing fine... writing file give some illegal char...