I am not a Perl programmer. But I badly need to fix my colleague's code, and I'm stuck. Please excuse me if I came to a wrong place.
Here's the slightly obfuscated snippet from real script:
#!/usr/local/bin/perl -w use strict; sub get_useful_number_1() { my ($self, $harness, $bridle_radius, $max_spit_distance, $num_legs +, $last_name, $day_phone, $days_without_water) = @_; my $camel_id; if (1 == 1) { $camel_id = get_camel_id($self, $harness, $bridle_radius, $max_ +spit_distance, $num_legs, $last_name, $day_phone); # line above: NO COMPLAINTS } } sub get_camel_id() { my ($self, $harness, $bridle_radius, $max_spit_distance, $num_legs +, $last_name, $day_phone) = @_; my $camel_id = 18; if ($camel_id == 18) { return($camel_id); } else { return(-18); } } sub get_useful_number_2() { my ($self, $harness, $bridle_radius, $max_spit_distance, $num_legs +, $last_name, $day_phone, $days_without_water) = @_; my $camel_id; if (1 == 1) { $camel_id = get_camel_id($self, $harness, $bridle_radius, $max_ +spit_distance, $num_legs, $last_name, $day_phone); # line above: Too many arguments for main::get_camel_id at ./er +rand-01.pl line 41, near "$day_phone)" } } 1;
The code won't compile, giving a syntax error message "Too many arguments". The only difference between caller1 and caller2 is... the 2nd one is located after the function I need to call in the file.
My best bet: it's related to the sin #2: http://www.perl.com/pub/a/1999/11/sins.html#2
Can anybody bring piece back to my life please?20050416 Janitored by Corion: Added formatting, changed PRE to CODE, linkified link
In reply to Badly need to call a function...:-) by Mabooka-Mabooka
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |