in reply to Creating new file

I figured out open (OUT, ">out.txt") but I'm stuck on how to pass the data into the file.

print OUT "@results\n"; close(OUT);

You don't need to use a join() to put spaces between the elements in @results. Array interpolation will do that for you.