Dear Monks,


I crave your benevolence for this error.

I have already had some help on getting to this stage with this code but I'm coming a cropper on slitting the trailing null bytes from the generated list.

The code uses CGI::Vars which I believe is causing the trailing \0 in the generated list. The code is designed to put the $column string into the SELECT part of the SQL query as part of moving the whole thing from ODBC to DBI. When the code is run without any 'split' it outputs the lists with trailing bytes but if I uncomment my split I get a numeric return which I assume is the number of variables returned which doesn't help whilst trying to build a list of columns. $fd is the params part of vars() and the @columns code is working.

my @columns = join ',', map { $db->quote($fd{$_}) } grep { exists $fd{$_}} ('chk'); my $columns = split/\0/, @columns; SQL code SELECT $column

I'd be grateful for some pointers as to what I have done incorrectly so that I can learn from this and get it right in the future.

Thanks


In reply to Splitting \0 by Quicksilver

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.