in reply to Confused about 'Name "main::whenfound" used only once:'

Just an observation about your code. $#ARGV is the highest index number in the array @ARGV. If you need to know how many elements in an array, then use it in scalar context, for example:
$argc = @ARGV; if ( @ARGV == 2) {

etc.