$two = 'test'; @three = ('test'); my @array = ('one', 'two', 'three'); foreach (@array) { if (@$_) { print "Array exists: $_\n"; } if ($$_) { print "Scalar exists: $_\n"; } }