in reply to if (defined @arr) problem

Curiously enough perldoc -f defined has something to say about this:
Use of "defined" on aggregates (hashes and arrays) is depre- cated. It used to report whether memory for that aggregate has ever been allocated. This behavior may disappear in future versions of Perl. You should instead use a simple test for size: