in reply to Creating Variables Just to Pass into Subroutine?

If it were me, I wouldn’t care if arguments were put into variables ... as long as those variables were local, not global, and as long as they were declared.   This program is obviously very old.   If it has a large set of global variables, those variables create “coupling” all over the place.   If the variables are local, it actually might improve “at-a-glance readability” to use variables because each call to ampNotify() can be desk-checked visually.

I would start with the basics:   adding use strict; use warnings; to the top of each module and checking for resulting compile-errors.   Arrange the program into subroutines, or even in-line blocks, in which variables are local and declared with my.

Start now thinking about test-cases, e.g. Test::Most, by which you can verify what the program is doing now, at various levels, and ensure that the code does not “regress” (break ...) as you make changes to it.

Finally, get to know git, a version-control system that can work within a single directory or set of directories.   Start by creating a repository out of the current directory and check-in the unchanged program.   As you make each change, create a branch to make the change in, then merge the change back into the master-branch.   Use a source-code editor of your choice with built-in support for git.   In this way, you not only preserve a record for yourself of what changes you made and why, but you can also reliably revert the code to any prior state ... and “un-revert it again,” if you wish.   Even if you are the one-and-only person who is working on the code, it’s a great tool to use.

Replies are listed 'Best First'.
Re^2: Creating Variables Just to Pass into Subroutine?
by BrowserUk (Patriarch) on Jul 22, 2015 at 12:14 UTC

      I'm afraid you might be suffering a chronic case of low level buzzword toxicity.

      There are good points in the core message, but the actualizing of the narrative leaves potential for process improvements.

      Why? Do you recommend global variables? Do you recommend not using strict and/or warnings? Do you recommend not testing? Do you not recommend version control?

      You need to check yourself, BullyUk. This is one time when your hatred is unfounded and unwanted.

      READ FIRST!

Re^2: Creating Variables Just to Pass into Subroutine?
by Anonymous Monk on Jul 22, 2015 at 16:50 UTC

    S-Dial verbiaged:

    ..git...create a branch to make the change in, then merge the change back int.o the master-branch.

    Why? And what do I do with the branch afterward?

        /me sighs.

        Something a bit more dexterous: https://about.gitlab.com/2014/09/29/gitlab-flow/

        The word "agile" is overloaded of late.