in reply to Creating Variables Just to Pass into Subroutine?

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

Replies are listed 'Best First'.
Re^2: Creating Variables Just to Pass into Subroutine? (named arguments)
by mdskrzypczyk (Novice) on Jul 22, 2015 at 13:35 UTC
    Thanks for the input, yes this code is going on about 15 years old at the least... I have a question about the way the arguments are being passed, it looks a lot like hash notation found in perl so I'm confused about how the arguments get interpreted on the subroutine side. Does this implementation require a change in the subroutine itself or will it still be able to read the same arguments that are passed in, meaning that this is only a change to the way the subroutine is called?
      I know it's confusing but => is not a hash notation (ie not exclusively) like : in JS or python.

      it's just a list separator, see "fat comma". I.e. you are passing a list.

      There are two ways to pass hashes , either as a flat list and you have to copy @_ later to a %arg hash. (See example link)

      or as a anonymous hash in curlies and you have to read the hash ref from $_[n] (see my other post)

      HTH ! =)

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