in reply to ct_cmd_alloc failed

Prior to posting, you should do some basic cleanup like running your script through at least perltidy -io to get the indentation right.

That helps a lot with reading. Then, I can't match the line numbers of the errors you get with the script:

ct_cmd_alloc failed at ./chris_create_login.pl line 348, <STDIN> line +1. no statement executing at ./chris_create_login.pl line 350, <STDIN> li +ne 1. 346 $sth->execute(); 347 348 while ( my ( @array ) = $sth->fetchrow_array() ) { 349 $result .= "\t $array[0] \t $array[1] \n"; 350 } ct_cmd_alloc failed at ./chris_create_login.pl line 173, <STDIN> line +1. 170 $sth->execute(); 171 172 my $servers = $sth->fetchall_arrayref(); 173 174 $sth->finish(); 175 Can't call method "prepare" on an undefined value at ./chris_create_lo +gin.pl line 195, <STDIN> line 1. 192 my $sth = $$dbh->prepare($sql) 193 or app->error($ERROR, "Can't prepare SQL statement [ $sq +l ] :: $DBI::errstr"); 194 195 $sth->execute(); 196 197 my $idvalues = $sth->fetchall_arrayref(); 198

It seems like you altered the script after you got the errors, and before posting.

I can not figure out why one sub routine works and another one does not.

Some basic debugging techniques could help, like printing arguments to subroutines to STDERR. Then, check whether your database handle really is and does what you expect it to do, before you do anything with it. Look up the ping method in the DBI doc and the docs for your database driver. See also brian's Guide to Solving Any Perl Problem.

--shmem

_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                              /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}