Hi all,

Is there anybody out there who has a code snippet to test if a list is empty?
(a list is empty if all elements are either undefined or 0 or have an empty 
string)

Ofcourse I can do this:

my $str = '';
my $elem;

my (@test) = (undef, ''); #put any test data here
foreach $elem (@test) {
        $str .= $elem;
}

if ($str) {
        print "not empty\n";
}
else {
        print "empty \n";
}


But somehow I think there is a more clever or shorter way.

Is there?

Cheers,

Jeroen


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to