in reply to using $ARGV without arguments

When you don't pass anything in, $ARGV[0] won't be defined. Under use warnings, trying to compare an undefined value gives you that (non-fatal) error message. To stop it, first check if $ARGV[0] is defined, then do your test:

if( defined($ARGV[0]) && ($ARGV[0] eq 'TEST') ) {

----
I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
-- Schemer

Note: All code is untested, unless otherwise stated