in reply to default values

Assuming the 0 is not one of the possible values
$val ||= $default_val;
If 0 could be proper value (and isn't the default, otherwise the above would still work)
$val = $default_val unless defined $val;
Dealing with possible undefs and 0 as the state of $val will require it 3 times I think
$val = $default_val unless defined $val && length($val);
I suspect others might have shorter solns... FORE!

Replies are listed 'Best First'.
Re: Re: default values
by BUU (Prior) on Sep 16, 2003 at 05:19 UTC

      I tried this but it did not work. ;-)

      cheers

      tachyon

      s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

        Where did you get the Perl6 module from? It's not on cpan, so I don't know how you tried it (and "it doesn't work" doesn't mean much).