in reply to Re: Re: Re: creating a particular hash
in thread creating a particular hash

If you have a default value to return, this is where I prefer to chain the "x ? y : z" operator:

return ! $bindings ? undef : var_match $pattern ? extend $bindings : @$input ? pat_match(rest $input) : $default_value;

I know that it looks a little odd at first, but once you get used to the syntax, I find it even easier than case or switch statements.

Cheers,
Ovid

Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.

Replies are listed 'Best First'.
Re: (Ovid - chaining operators) Re(4): creating a particular hash
by Henri Icarus (Beadle) on Jun 02, 2001 at 09:41 UTC
    Don't you get into trouble with operator precedence when you do this and start using && and such in your conditionals? Or am I just remembering old bugs in my C code :-)