I personally have not seen blanks come back with any of my columns unless
someone accidentally entered a whitespace character in a varchar
field. ChopBlanks=>1 should remove all trailing whitespace from CHAR
fields only. If you want trailing whitespace removed from VARCHAR or
other datatypes returned, use a regex to strip it.
Based off a Perl Cookbook recipe I learned when I first started
programming Perl, you can create a very simple trim() routine that'll
remove leading/trailing whitespace:
sub trim
{
my @out = @_;
for (@out)
{
s/^\s+//; ### Remove leading whitespace
s/\s+$//; ### Remove trailing whitespace
}
return wantarray ? @out : $out[0];
}
So if you just want to pass one value or an array of values to trim(),
it'll get rid of that pesky whitespace that no one wants.
If you want to then pad the data with whitespace for fixed formatted
output, just use sprintf and supply the formatting you want.
HTH
--Curt
On Mon, 18 Jun 2001, [iso-8859-1] Klaus Dittrich wrote:
> Hello all,
>
> I just startet using DBD::Sybase (after experimenting with
> DBD::Oracle and DBD::ODBC), and I found some effects I don't
> know how to handle.
>
> 1. Is it possible to avoid the additional Blank after each
> column I select (it does not appear always, but in most cases)?
> I know it can be avoided in isql, but how is it done in DBD::
> Sybase (without losing the blanks I need for a fixed format
> output, i.e. ChopBlanks does not help) ?
>
> 2. In some obscure cases, all Blanks are chopped when I add
> an Order-By-Clause to an Select, though I explicitely cast
> the columns to a fixed length. Without Order-By the Blanks
> are not chopped and I get a Fixed-Length-Output.
> Can this behaviour be changed (or can someone explain it to me)?
>
> I'm using Perl 5.005_03 and DBD::Sybase 0.22.
>
> Thanks in advance.
>
> Klaus Dittrich
> Mannesmann Mobilfunk GmbH
> Duesseldorf, Germany
> [EMAIL PROTECTED]
>
>
>
>
> ________________________________________
> Der clevere Infobote - Shopping-Tipps bequem abonniert. Jetzt neu bei
>http://www.epost.de
>
>
>