Siegfried Heintze wrote:
How do I distinguish between no value and false? I thought defined was supposed to do that.
defined is true if its defined and false if it is not defined its defined if its been given a value that is defined as '' or 0..
Try this out, uncommenting the different my $foo's to see hwo it works (IE only one my $foo uncommented at atime of course ;p)
#!/usr/bin/perl
use strict; use warnings;
my $foo = undef; # my $foo = ''; # my $foo = 0;
# All three of those are considered false: print "Foo is false\n" if !$foo;
die 'Foo is not defined' if !defined $foo; die 'Foo is empty' if $foo eq ''; die 'Foo is Zero' if $foo == 0;
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>