in reply to (Beginner) Return number of variables within a set distance.
The other thing that jumps out at me is that you increment the counter inside a set of braces. I do not see a use strict;. I would be worried that you are dynamically creating, incrementing, and destroying a local copy of $counter, and then your final print statement is dynamically creating a global copy of $counter -- which has a value of zero.
I haven't not used strict in so long I can't remember the precise behaviors of Perl under those undisciplined parameters.
|
|---|