Michael, Well spotted on the database question. I am trying to handle parameters from UNIX that call a PERL script the uses DBI, that then calls Sybase stored procedures. The problem I have found is that they don't pass the strings with single quotes and dates are 02-27-02, again without quotes. So I tried to quote them but found that they pass some numbers as well for "int" datatypes and some are negative and some are positive. The only thing left is to try and access syscolumns in Sybase and try and work out what the parameters are and then add quotes or leave them out. I thought I would try with the option of not quoting numbers. It is a total headblower and I don't have much time. Gus ----- Original Message ----- From: Michael Fowler <michael@shoebox.net> To: Angus Laycock <angus.laycock@tesco.net> Cc: <beginners@perl.org> Sent: Wednesday, February 27, 2002 11:14 PM Subject: Re: Creating a string with quotes and delimiters from an Array > On Tue, Feb 26, 2002 at 06:07:33PM -0000, Angus Laycock wrote: > > I have an array ----> @array = qw(alf bert charlie 4) > > > > and I want a string that contains this value < 'alf','bert','charlie','4' > > > with the single quotes and commas. > > $str = join(',', map { "'$_'" } @array); > > > > Also, how can I check if one of the values is numeric so I dont put quotes > > around it? So the result is like this ---> < 'alf','bert','charlie',4 > > > $str = join(',', map { /\D/ ? "'$_'" : $_ } @array); > > "value is numeric" is a little vague; I went with a regex that's simple, but > won't catch quite a few variations. See perldoc -q 'is a number' for > alternatives. > > > By the way, what is this for? It looks suspiciously like you're using it > for database inserts or something along those lines; there are better > alternatives if that is the case. > > > Michael > -- > Administrator www.shoebox.net > Programmer, System Administrator www.gallanttech.com > -- > > -- > To unsubscribe, e-mail: beginners-unsubscribe@perl.org > For additional commands, e-mail: beginners-help@perl.org > >Thread Previous | Thread Next