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}

In reply to Re: ct_cmd_alloc failed by shmem
in thread ct_cmd_alloc failed by mnlight

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.