Hi Monks!
I have a question here regarding values coming into a sub routine. I have this external module and I share it with about 4 other programs I have. I call this sub routine in this module from all these 4 programs, lets say;
From program A:
build_url( $account ,$transaction, $location);
From prgram B:
build_url( $account);
From program C:
build_url( $account ,$transaction);
From program D:
build_url( $account ,$transaction, $location);
Now this is what the sub rutine inside of the mudole is expecting:
sub build_url { my ($account ,$transaction, $location) = @_; ....

Now, I need to pass 2 extra values into this sub routine, the new values expected inside of this sub routine will be like this:
sub build_url { my ($account ,$transaction, $location, $fname, $lname) = @_; ....

So my question here is what is the best way to do this to avoid the values of these 2 extra variables added to the call to this sub routine when the values are not in the order that the sub “build_url” is expecting?
Here is how the 2 new variables will be added to the call to this sub.

From program A:
build_url( $account ,$transaction, $location, $fname, $lname);
From prgram B:
build_url( $account, $fname, $lname);
From program C:
build_url( $account ,$transaction, $fname, $lname);
From program D:
build_url( $account ,$transaction, $location, $fname, $lname);
Now the sub build_url with the 2 extra variable added:
sub build_url { my ($account ,$transaction, $location, $fname, $lname) = @_; ....

See where some of the values would be in the wrong order? Should I make sure that I always pass 5 expected values to this sub routine even if I have to pass blank values, but preserving the order that the code is expecting them?
Thanks for the advice!

In reply to Values passed into a sub routine by Anonymous Monk

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.