Option 1:In order to use the otions in the script, you have to have getopt::Std installed (use Getopt::Std) as mentioned at the top of the script. Read here for more info. This should solve your issue.
Option 2:Wipe out all of the options, and setting $agedays=$ARGV which would be the same as running agecmd.pl days. This requires no additional modules, but you'd have to rewrite the error checking so that the argument is a number and not "xfl" or something equally incorrect. Here is a thread referencing this option.
Option 3: Or you can wipe out the whole options section at the top and just simply set $agedays to whatever number of days you require.