in reply to Why does this code quit?

You read from ADDRESS in a loop, but it is opened for writing.
So the loop ends after the first round and the program exits.

I think you should use something else to control that loop.

Change the while (<ADDRESS>) { to while (1) { and add something like:

print 'Enter another address?'; my $answer = <>; last if $answer !~ /[yY]/;
at the end of the loop.