Charles K. Clarkson wrote: > david <[EMAIL PROTECTED]> wrote: > : > : this is impossible in Perl. show me an example > : where something is neither true nor false. > > Er, um, well ... > > #!/usr/bin/perl > > package foo; > > use strict; > use warnings; > > use Carp 'croak'; > use overload bool => \&boolean; >
[snip] > > sub boolean { > my $self = shift; > return $self->{value} if $self->{bool}; > > croak "Sorry this value does not evaluate as either true or as false"; > } > [snip] > > $foo->value( 'ambiguous' ); > print "true\n" if $foo; > > __END__ you simply overload bool and croak out when you set it with ambiguous. what does that prove? how is it related to creating an expression where it's niether true nor false? if your example counts, why not simply: #!/usr/bin/perl -w use strict; my $i = undef; if($i){ exit; }else{ die "sorry \$i does not evaluate as either true or as false\n"; } __END__ how does simply putting a piece of logic in your code and print out an error meesage when a variable match a certain value prove something in Perl is either true nor false? this is simply impossible in Perl because you can never code a 3-way logic. david -- s$s*$+/<tgmecJ"ntgR"tgjvqpC"vuwL$;$;=qq$ \x24\x5f\x3d\x72\x65\x76\x65\x72\x73\x65 \x24\x5f\x3b\x73\x2f\x2e\x2f\x63\x68\x72 \x28\x6f\x72\x64\x28\x24\x26\x29\x2d\x32 \x29\x2f\x67\x65\x3b\x70\x72\x69\x6e\x74 \x22\x24\x5f\x5c\x6e\x22\x3b\x3b$;eval$; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>