in reply to if (defined @arr) problem

Do not use & unless you know what you are doing.

Running your code under strict and warnings yields a message about using defined for arrays and invites to use just @a.

use strict; use warnings; sub test { undef; } my @a = test; if (@a) { use Data::Dumper; print Dumper \@a; } __END__ $VAR1 = [ undef ];

I hope this answers your question.

--
David Serrano