in reply to Confused about 'Name "main::whenfound" used only once:'
Your problem has been identified, and a number of other issues have been pointed out. This one hasn't been mentioned, but caught my eye:
unless ($found == undef) { ...
That's not doing what you probably think it is. undef in a numeric context like that is 0. So, if $found is... wait, where is $found being set? Actually, I have no idea what is happening there.
The point was that you should test definedness with defined():
if ( defined( $found )) {...}
Thanks to a series of coersions, your code is functionally equivalent to:
if ( $found ) { ... }
|
|---|