There are a lot of weird things in that code, which makes it hard to figure out how to fix it. If you'd put comments in to indicate what you expect each line or tightly-related group of lines to do, it would be easier. It might also cause you to see some things that don't make sense.
I think, at least, that you want @results = $each_line to be push @results, $each_line. And %array_out should be @array_out. All the hash processing most likely goes after the for loop.
use strict;
use warnings;
would be your friends here, as well.
Caution: Contents may have been coded under pressure.