This looks like pretty old style (aka perl 4) code.

You should use my in front of variables and you don't need & to call functions anymore.

To answer your question, the real problem are the many positional parameters you need.

In this case "Throw away" variables help documenting your code and improve readability.

BUT the far better solution would be to pass named arguments.¹

edit

e.g.

ampNotify( who => "su_and_it", subject => "Error processing $filename", severity => 3, othercontact => "None", path => $work_dir, file => $missingdeptfilename, message => <<"__message__"); Server: $server File: $origfile Error: Departments missing from WWMBR_NAMES.TXT __message__

Please note that the use of a here-doc for the message is not essential for this solution, you are also free to write something like

ampNotify( ... message => qq(Server: $server File: $origfile Error: Departments missing from WWMBR_NAMES.TXT), othercontact => "None", ... );

TIMTOWTDI, Perl gives you the freedom to chose the best readable/maintainable form for your team, even an extra $message variable can be a good choice here.

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!

UPDATE

changed the order of arguments, since Here doc must immediately follow the opening << line.

Thanks to choroba for messaging me. :)

¹) example


In reply to Re: Creating Variables Just to Pass into Subroutine? (named arguments) by LanX
in thread Creating Variables Just to Pass into Subroutine? by mdskrzypczyk

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.