http://www.perlmonks.org?node_id=160812


in reply to undef'ing @arrays caveat

Actually Juerd is right as far as my code goes.. In one of my scripts i have a subroutine which at the end does this:
sub a_sub { my @things; . . . return ($should_return_stuff) ? @things : (); }
In previous version of the code, I overlooked this part and had 'undef' in place of the pair of brackets '()' (for empty array). Since I have to do this conditional in the return statement, I can't simply have a return; statement all by itself (well, i could... but not without having to add an extra line of code). I somehow assumed that returning 'undef' would make things work. Certainly, I'm a new man now.. clean of the indispicable sin of the past *grin*.

Thanks you all for good points/comments. My initial post was in fact meant to dispose the kind of stupidity that other monks (ak'a myself) get into from time to time. Also, I hoped the post could help a rare few monks who could otherwise fall in the same trap that I did... no big issue, though. ;-)

"There is no system but GNU, and Linux is one of its kernels." -- Confession of Faith