Prototypes are a horrible idea. Still if you want to make that mistake you can by predeclaring the function so that inside the function it knows the prototype:
sub check_ip();
sub check_ip() {
eval{
my $ip_test = new Net::IP(`curl whatismyip.org`);
return $ip_test->ip();
};
if ($@){
sleep(300);
check_ip();
};
}