http://qs1969.pair.com?node_id=121657


in reply to Problem with while loop

Not Hopeless, but definitely "needs work". For starters, you will want to use strict; and use warnings; (or -w depending on the age of your Perl). This and some careful thinking of where you use your variables (and where you don't) should go a long way to clearing up your confusion.

A quick look did reveal that you never assign to $idx1 so that part of your last loop probably isn't doing what you think it is. That loop also refers to $replica which is the loop variable from the previous foreach and also not likely what you want as it will always just be the last element in @replicas. You also use $rephash(stuff) in that loop when you need to use {} as you have declared it as a hash. Again, you need to step back a bit and figure out just what you are doing with all these variables.

There are lots of other things that could be done to make this more Perlish, but you need to get your logic straight first.

--
I'd like to be able to assign to an luser