in reply to changing value to ones on array
And while you're at it, you may want to check out "perldoc perlstyle" as the wisdom therein will make your code much easier to read.