On Fri, 14 Jan 2005 00:24:10 +0900
Shinya Hayakawa <[EMAIL PROTECTED]> wrote:

> Is there any objections to use ||= op
> instead of writing the following code?
> 
> @ary = (...) unless @ary;
> @ary or @ary = (...);
> 
> This means enabling @ary ||= (...); as well as &&=, //=;

X ||= Y should be a shortcut for X = X || Y, but currently

  @foo = qw(a b c);
  @foo = @foo || qw(d e f);

results in that @foo = (3) because '||' op forces a scalar context. So
I'm afraid it's not the same as '@ary or @ary = (...)' stuff.

-- 
Tatsuhiko Miyagawa <[EMAIL PROTECTED]>

Reply via email to