And here is the code example that works that I wanted to send:

use warnings;
use 5.010;
use Want;

f();

say f(1);           # 1
say f(0);           # 0
say '-' x 10;       # ----------
if (f(1)) {
        say 1;          # not reached
}
if (f(0)) {
        say 0;          # 0
}
say '-' x 10;       # ----------
say f(0) ? 0 : 1;   # 0
say f(1) ? 1 : 0;   # 0

my $x = f(0) + f(1);    # ohoh

sub f {
        my $val = shift;

        if (want('BOOL')) {
                return $val ? 0 : 1;
        }
        if (want('LIST')) {
                return $val;
        }
        if (want('VOID')) {
                return;
        }

        die "ohoh\n";
}
_______________________________________________
Perl mailing list
[email protected]
http://mail.perl.org.il/mailman/listinfo/perl

Reply via email to