Sidenote: Using both $array and @array in your code decreases its readability and makes it error prone.
In reply to Re: chomp - reference by choroba in thread chomp - reference by michaelp