in reply to Re: Re: Did I match or didn't I?
in thread Did I match or didn't I?

The only difference between or and || is precedence. || has high precedence; or has low precedence.

  my @list = func_returning_list() || 'default'; This is parsed as my @list = (func_returning_list() || 'default');, which fails because || forces func_returning_list() into scalar context.   my @list = func_returning_list() or 'default'; This is parsed as (my @list = func_returning_list()) or 'default';, which fails because 'default' is not assigned to @list when func_returning_list() returns an empty list.

Using ?: is the right solution.

In perl6, the logic operators will allow their context to propagate to both their operands, so the first snippet will work as intended.