Venerable sirs!

The result written into the database table by this script below is unreadable. Eg: "Asistente de Dirección" = "Asistente de Dirección"

But if i write the resluts into a text file it is readable. Where have i gone wrong? (Ignore the functions load and Adump)

#!/usr/bin/perl -w use strict; use LWP::UserAgent; use HTTP::Cookies; #use lib '/Perl/site/lib/myModules';s use myModules::initHTTP qw(:all); use DBI; initHttp('http://water:8080'); ###################################################################### +#### my ($dbh) = DBI->connect('DBI:ODBC:xxxx', 'xcx', '') or die "Couldn't +connect to database: " . DBI->errstr; ###################################################################### +#### getAll(); ###################################################################### +#### $dbh->disconnect(); ###################################################################### +#### sub getAll{ print "Fetching All records\n"; my $rs = sendRequest('GET', 'http://www.mycareer.loreal.com/candid +ate/searchjobresults_xml.asp?l=15'); #fetch page while ($rs =~ m!vacancytitle="(.*?)".*?country="(.*?)" startdate=" +(.*?)".*?employmentfield="(.*?)".*?/>!isg){ print $1."\t".$2."\t".$3."\t".$4."\n"; insert($1, $2, $3, $4); } #Adump($rs);exit; } sub insert{ my ($vacancytitle, $country, $startdate, $employmentfield) = @_; my $sth2 = $dbh->prepare('insert into xxxx..Loreal (vacancytitle, +country, startdate, employmentfield) values (?, ?, ?, ?)') or die "Co +uldn't prepare UPDATE statement: " . $dbh->errstr; # this line is onl +y for the Itchy server $sth2->execute ($vacancytitle, $country, $startdate, $employmentfi +eld) or die "Couldn't execute INSERT statement: " . $sth2->errstr; $sth2->finish; } sub load { $/ = undef; open OUT, 'optList.asp'; my $p = <OUT>; close OUT; return $p; } sub Adump { my $lst = shift; open OUT, '>Loreal.xml'; print OUT $lst; close OUT; }

Formatting added by GrandFather

2006-10-16 Retitled by GrandFather, as per Monastery guidelines
Original title: 'The result is unreadable'


In reply to Fine when written to text file, but unreadable when written to database table by Kanishka

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.