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
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.sub get_Origserver() { print "******GETTING SERVER NAME OF THE DB BEING COPIED******\n"; my ($dbh) = @_; }
In reply to Too many arguments for main:: by mnlight
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |