I'll admit it. I'm confused too. You say that you add_client() sub "works fine", but I don't undertsand how it could? I just tried to simulate your code and any attempt I made to call add_client(); with paramters caused the compile time error:

Too many arguments for main::add_client at ... near "'password' )"

This is exactly what I expected. Maybe I am missing something?

#! perl -sw use vars qw($app $FATAL); use strict; $app = 'test'; $FATAL = 'FATAL'; sub add_client() { print "******ADDING ROW TO CLIENT TABLE******\n"; print "I AM HERE\n"; my ($dbh, $clt, $prdpasswd) = @_; my $count = 1; my $cltid; my $sql = "select distinct CLT_ID from ENRMASTER..CLT order by CLT +_ID"; my $sth = $$dbh->prepare($sql) or $app->error($FATAL, "can't prepare SQL statement [ $sql ] : +:$DBI::errstr"); $sth->execute(); } # 1047 my $cltid = add_client(\$dbhTarget, $clt, $passwd); add_client(); # the compiler accepts this but it wouldn't do anything +useful. add_client( 'handle', 'clt_id', 'password' ); ## << Line 25 __END__

gives

c:\test>209750 Too many arguments for main::add_client at C:\test\209750.pl line 25, +near "'password' )" Execution of C:\test\209750.pl aborted due to compilation errors. c:\test>

Nah! Your thinking of Simon Templar, originally played by Roger Moore and later by Ian Ogilvy

In reply to Re: One sub routine call works a similar one does not. by BrowserUk
in thread One sub routine call works a similar one does not. 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.