I keep getting this error from this code.

Too many arguments for main::get_Origserver at ./create_database.pl line 1053, near "$dbhTarget)" Execution of ./create_database.pl aborted due to compilation errors.

1023 LABEL: 1024 print "\nCREATE A DATABASE FOR EXISTING CLIENT OR COPY AN EXIS +TING DATABASE? \n"; 1025 print "Create Existing Client Database => 1\n"; 1026 print "Create New Client Database C=> 2\n"; 1027 print "Copy Existing Database => 3\n"; 1028 chomp(my $answer = lc(<STDIN>)); 1029 1030 if ($answer eq "1") { 1031 1032 my $cltlist = display_client(\$dbhTarget); 1033 if ($cltlist) { 1034 $cltlist = "Existing clients: \n" . $cltlist . 1035 "\nEnter Client ID: "; 1036 print $cltlist; 1037 chomp(my $cltid = <STDIN>); 1038 $params->put("Client.ID", $cltid); 1039 }#end if statement 1040 1041 } elsif ($answer eq "2") { 1042 1043 print "Please enter new client name: \n"; 1044 chomp(my $clt = <STDIN>); 1045 my $passwd = $params->get("Prod.Password"); 1046 my $cltid = add_client(\$dbhTarget, $clt, $passwd); 1047 $params->put("Client.ID", $cltid); 1048 1049 } elsif($answer eq "3"){ 1050 1051 print "Please enter name of the database to copy: \n"; 1052 chomp(my $Origdb = <STDIN>); 1053 my $Origserver = get_Origserver(\$dbhTarget); 1054 print "$Origserver is the server for the original db\n"; 1055 1056 } else{ 1057 1058 print "YOU MUST CHOOSE AN OPTION!!!!\n"; 1059 goto LABEL; 1060 1061 }#end else statement
sub get_Origserver() { print "******GETTING SERVER NAME OF THE DB BEING COPIED******\n"; my ($dbh) = @_; }
When I pass a variable to the sub I get the error if I don't pass a variable it runs fine but my variables are not populated. I have never encounterd this error before. the one thing that is different is I do have a goto statement.

In reply to 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.