in reply to Re: postfix incrementing of hash slice
in thread postfix incrementing of hash slice

This might be a typo in shmem's code, but the value '1' should be in list context. There is no need for 'scalar' since the rhs of the x operator can only be a numeric scalar. So I prefer:
@hash{@array} = (1) x @array;
With a suitable comment, since it is not particularly obvious.

Replies are listed 'Best First'.
Re^3: postfix incrementing of hash slice
by ysth (Canon) on Oct 01, 2006 at 17:26 UTC
    Note that this is one of the few places where adding () changes context - and I prefer to think of it as list-context ()x being a different operator than x. AIUI this is fixed in perl6 to actually have have different characters for the two operators.