Quicksilver has asked for the wisdom of the Perl Monks concerning the following question:
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
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Splitting \0
by japhy (Canon) on Jun 01, 2007 at 11:26 UTC | |
by Quicksilver (Scribe) on Jun 01, 2007 at 12:14 UTC | |
Re: Splitting \0
by holli (Abbot) on Jun 01, 2007 at 11:14 UTC | |
by Quicksilver (Scribe) on Jun 01, 2007 at 11:30 UTC | |
by holli (Abbot) on Jun 01, 2007 at 11:38 UTC | |
by FunkyMonk (Chancellor) on Jun 01, 2007 at 11:46 UTC | |
by Quicksilver (Scribe) on Jun 01, 2007 at 12:04 UTC | |
by holli (Abbot) on Jun 01, 2007 at 12:11 UTC | |
Re: Splitting \0
by Quicksilver (Scribe) on Jun 01, 2007 at 14:49 UTC |