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

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.