Received: from modemshr (outside9.audioprecision.com [208.129.210.109]) by hub.org (8.9.3/8.9.3) with ESMTP id TAA41589 for ; Thu, 10 Jun 1999 19:36:58 -0400 (EDT) (envelope-from wadeb@ap.com) Received: from ap.com (really [192.42.172.8]) by modemshr via smail with esmtp (ident wadeb using rfc1413) id (Debian Smail3.2.0.102) for ; Thu, 10 Jun 1999 16:35:57 -0700 (PDT) Sender: wadeb Message-ID: <37603EAC.C50BDC87@ap.com> Date: Thu, 10 Jun 1999 15:39:40 -0700 From: Wade Burgett X-Mailer: Mozilla 4.08 [en] (X11; I; Linux 2.2.1 i586) MIME-Version: 1.0 To: pgsql-interfaces@postgresql.org, wadeb@burgettsys.com Subject: Choppin' Blanks with DBI and DBD::Pg Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit A bit of a newbie perl hacker here but I am having some problems getting the whitespace removed from the end of my records. I am not sure whether this is due to my stuffing the hash incorrectly or some misunderstanding of DBD-DBI and the ChopBlanks attribute, or the cosmic random factor. When I return records from my database (using the slect statement below) I get the full field length of characters, which includes whitespace, which I don't want. It looked like what I wanted was the ChopBlanks attribute from DBD:Pg here's the man: ChopBlanks (boolean,inherited) Supported by the driver as proposed by DBI. This method is similar to the SQL-function RTRIM. sounds like it takes off trailing whitespace (but I could be wrong here). Here's my perl: #initialize options %MyAtts = ('ChopBlanks',True); #Connection to database (OBject) $dbh = DBI->connect("DBI:Pg:dbname=$database"); if ( !defined $dbh ) { die "Cannot do \$dbh->connect: $DBI::errstr\n"; }; #Prepare then execute query $sth = $dbh->prepare("Select firstname, lastname, username, passwd, username, winpasswd from $table where unixdone ='N'",\%MyAtts ); $sth->execute; Things I tried: using 1 instead of true in ChopBlanks not using the \ in front of %ChopBLanks after the select statement (generates error). initializing the hash w/ => syntax (no change) Thanks for any help. Aplogies if this is some sillly syntax error (but my -w isn't complaining so ? ) Wade