You are right, I forgot to put the print statement. Actually I'm pretty knew to perl so I have some problems wraping my mind around all the perl functions.
As I understand by this point my script, when it encounters an unknown location it will not search for coordinates, instead it will take the previous detected coordinates and replace the ones in the unknown location.
As you suggest, it doesn't really look as a good practice, but for know it works for me... Thank you for your advices nevertheless