From: mike <mailto:[EMAIL PROTECTED]> wrote:

: I have the following code
: 
: print "date times",@date,br;
: if ($ti1){
: print "time 1 is not empty";
: }
: else {
: print "time 1 is empty";
: }
: 
: If there is a value it works but not if there isn't
: ie: if there is a value it prints "time 1 is not
: empty", but if there is not nothing comes out
: 
: anyone any ideas?

    Works for me. Perhaps you need to show more code
post something that produces the error.


foreach my $ti1 ( '', 0, 4, undef, 'hello', ) {

    if ( $ti1 ) {
        print "time 1 is not empty\n";

    } else {
        print "time 1 is empty\n";
    }
}

prints:

time 1 is empty
time 1 is empty
time 1 is not empty
time 1 is empty
time 1 is not empty






-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to