in reply to Determining when the last day a script will run...

Quick and easy hack:

for (`cal`) { /^(\d+)/ && $x=$1; } print "Latest Sunday is $x!\n";