in reply to Re^2: count multiple variables in a single array.
in thread count multiple variables in a single array.

…changing directories it does get very confusing, but sometimes a necessary evil…

I am open to being shown incorrect but I don’t think it’s ever necessary and in every case I have come across it so far—including some of my own older stuff—I find it to be code smell.

  • Comment on Re^3: count multiple variables in a single array.

Replies are listed 'Best First'.
Re^4: count multiple variables in a single array.
by Marshall (Canon) on Feb 28, 2020 at 23:11 UTC
    I equivocated in my post to the OP.
    I also don't see any "necessary evil"
    Some Perl libraries like File::Find do chdir's for their work and error recovery from a something like that can be very problematic because you can wind up in some random directory. The &wanted routine should be as simple as possible to avoid this problem.
    In general, chdir is a bad idea.
    I could think of situations where a chdir to a program's data could simplify the code slightly, but I also don't see "necessary evil", meaning "required".