Hello Kind and Wise Monks:

I have a requirement to produce a CSV file containing security identifiers. Using Text::CSV_XS the task has proceeded very smoothly. However, an issue has surfaced that puzzles me.
Please look at the following:
ISIN: **US4663671091** CUSIP: **466367109** BBCode:**JBX UN** SEDOL: **2344922** Ticker: **JBX** SecType: **Equity** SecDesc: **JACK IN THE BOX INC** SecCurr: **USD** US4663671091 ISIN 466367109 CUSIP 05 30 CSV String: US4663671091,ISIN,466367109,CUSIP,,,05,30,,,,"JACK IN THE +BOX INC",,,USD,,, End-Of-Record

Notice the line before End-Of_Record, JACK IN THE BOX INC is in quotes. Why oh Why would Text::CSV do this? I did nothing different with this string?
My code is below.

Many thanks for considering my problem.

kd

while($db->FetchRow()){ undef %rowData; %rowData = $db->DataHash(); print " ISIN: **". $rowData{ "ISIN"} . "**\n" ; $ISIN = $rowData{ "ISIN"} ; print "CUSIP: **". $rowData{ "CUSIP"} . "**\n" ; $CUSIP = $rowData{ "CUSIP"} ; print "BBCode:**". $rowData{ "Bloomberg_Code"} . "**\n" ; $BBCode = $rowData{ "Bloomberg_Code"} ; print "SEDOL: **". $rowData{ "Sedol" } . "**\n" ; $SEDOL = $rowData{ "Sedol" }; print "Ticker: **". $rowData{ "Ticker" } . "**\n" ; $Ticker = $rowData{ "Ticker" } ; print "SecType: **" . $rowData{ "Security_Type" } . "**\n" ; $SecurityType = $rowData{ "Security_Type" } ; print "SecDesc: **" . $rowData{ "Security_Description" } . "** +\n" ; $SecurityDesc = $rowData{ "Security_Description" } ; print "SecCurr: **" . $rowData{ "Security_Issue_Ccy" } . "**\n +" ; $SecIssueCCY = $rowData{ "Security_Issue_Ccy" } ; #** ** ** ** ** ** ** # Set the Primary Identifier if ( defined($ISIN) ) { $PIdentifier = $ISIN; $PIdentifierType = 'ISIN'; $ISIN = undef; } elsif ( defined($CUSIP)) { $PIdentifier = $CUSIP; $PIdentifierType = 'CUSIP'; $CUSIP = undef; } elsif (defined($SEDOL)) { $PIdentifier = $SEDOL; $PIdentifierType = 'SEDOL'; $SEDOL = undef; } elsif (defined($BBCode)) { $PIdentifier = $BBCode; $PIdentifierType = 'Bloomberg'; $BBCode = undef; } else { $PIdentifier = $Ticker; $PIdentifierType = 'Ticker'; $Ticker = undef; } #** ** ** ** ** ** ** # Set the secondary Identifier if ( defined($ISIN) ) { $PIdentifier2 = $ISIN; $PIdentifierType2 = 'ISIN'; $ISIN = undef; } elsif ( defined($CUSIP)) { $PIdentifier2 = $CUSIP; $PIdentifierType2 = 'CUSIP'; $CUSIP = undef; } elsif (defined($SEDOL)) { $PIdentifier2 = $SEDOL; $PIdentifierType2 = 'SEDOL'; $SEDOL = undef; } elsif (defined($BBCode)) { $PIdentifier2 = $BBCode; $PIdentifierType2 = 'Bloomberg'; $BBCode = undef; } else { $PIdentifier2 = $Ticker; $PIdentifierType2 = 'Ticker'; $Ticker = undef; } print $PIdentifier . " " . $PIdentifierType , "\n"; print $PIdentifier2 . " " . $PIdentifierType2 , "\n"; #** ** ** ** ** ** ** # Set Class and Sub Class if ('CASH' eq uc($SecurityType) ) { $class = '07'; $subClass = '60'; } elsif ('BOND' eq uc($SecurityType) ) { $class = '01'; $subClass = '03'; } elsif ('EQUITY' eq uc($SecurityType) ) { $class = '05'; $subClass = '30'; } elsif ('EQUITYFUTURE' eq uc($SecurityType) ) { $class = '02'; $subClass = '30'; } elsif ('EQUITYOPTION' eq uc($SecurityType) ) { $class = '03'; $subClass = '30'; } elsif ('PREFEQUITY' eq uc($SecurityType) ) { $class = '05'; $subClass = '31'; } else { $class = '00'; $subClass = '00'; } print $class . " " . $subClass , "\n"; $status = $csv->combine( ($PIdentifier , $PIdentifierType , $PId +entifier2 , $PIdentifierType2 , "", "", $class , $subClass ,"", "","", $SecurityDesc , + "", "", $SecIssueCCY , "", "", "" ) ) ; print "CSV String: " . $csv->string(); print "\nEnd-Of-Record \n\n" ; # new line } # ** ** **

In reply to Text::CSV_XS issue by kevind0718

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.