I have removed the parens and it works. But this is where it gets really confusing. Why does this code work? I make the same call at line 1047 and it compiles what is the difference between the two calls or sub routines.
1024 LABEL: 1025 print "\nCREATE A DATABASE FOR EXISTING CLIENT OR COPY AN EXIS +TING DATABASE? \n"; 1026 print "Create Existing Client Database => 1\n"; 1027 print "Create New Client Database C=> 2\n"; 1028 print "Copy Existing Database => 3\n"; 1029 chomp(my $answer = lc(<STDIN>)); 1030 print "$answer\n"; 1031 if ($answer eq "1") { 1032 1033 my $cltlist = display_client(\$dbhTarget); 1034 if ($cltlist) { 1035 $cltlist = "Existing clients: \n" . $cltlist . 1036 "\nEnter Client ID: "; 1037 print $cltlist; 1038 chomp(my $cltid = <STDIN>); 1039 $params->put("Client.ID", $cltid); 1040 }#end if statement 1041 1042 } elsif ($answer eq "2") { 1043 1044 print "Please enter new client name: \n"; 1045 chomp(my $clt = <STDIN>); 1046 my $passwd = $params->get("Prod.Password"); 1047 my $cltid = add_client(\$dbhTarget, $clt, $passwd); 1048 $params->put("Client.ID", $cltid); 1049 1050 } elsif($answer eq "3"){ 1051 1052 print "Please enter name of the database to copy: \n"; 1053 chomp(my $Origdb = <STDIN>); 1054 my $Origserver = get_Origserver(\$dbhTarget, $Origdb); 1055 print "$Origserver is the server for the original db\n"; 1056 1057 } else{ 1058 1059 print "YOU MUST CHOOSE AN OPTION!!!!\n"; 1060 redo LABEL; 1061 1062 }#end else statement

This works

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(); }
This does not compile
sub get_Origserver() { 919 920 print "******GETTING SERVER NAME OF THE DB BEING COPIED******\ +n"; 921 922 my ($dbh, $Origdb) = @_; 923 print "This is the db $dbh\n";

In reply to Re: Re: Too many arguments for main:: by mnlight
in thread Too many arguments for main:: 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.