By and large,
don't use glob() in scalar context. The next time your program executes that line, it will provide the next *.ntp file from the original directory, even if $dir has changed, and after getting each *.ntp file, it will return undef once before restarting.
Try this instead.
if ( ! defined( $file ) ) {
$file = ( glob(...) )[0];
if ( ! defined( $file ) ) {
die "no NTP file\n";
}
}