in reply to using a subroutine

Good start. Some suggestions:

  • Use 'my' when declaring your variables. Global variables are generally Not Good
  • Assuming those aren't the only two directories you'll ever want to process, consider passing in the directories on the command line, either directly through @ARGV, or via Getopt::Long (or Getopt::Std, if you're old-school)
  • Congrats on using use strict
  • in this program, there's really no reason to have the directories read by one subroutine and processed by another. A subroutine should generally be potentially useful to more than one caller. If it is only ever going to be called in one place, consider just moving it to that place (one exception to this "rule" is if you're breaking out significant chunks of code for increased clarity)


  • Replies are listed 'Best First'.
    Re^2: using a subroutine
    by xjlittle (Beadle) on Aug 10, 2004 at 00:32 UTC
      your points are well taken. I will get into the habit of watching my my's and my ()'s.