my @x; print 'my @x;',"\n"; &checkdef; @x = (); print '@x = ();',"\n"; &checkdef; @x = (1); print '@x = (1);',"\n"; &checkdef; @x = (); print '@x = ();',"\n"; &checkdef; undef @x; print 'undef @x;',"\n"; &checkdef; @x = (); print '@x = ();',"\n"; &checkdef; sub checkdef { if (defined (@x)) { print "\@x is defined\n" } else { print "\@x is undefined\n" } } __OUTPUT__ my @x; @x is undefined @x = (); @x is undefined @x = (1); @x is defined @x = (); @x is defined undef @x; @x is undefined @x = (); @x is undefined