Description
The documentation is accurate to say that postfix deref works in all cases where block deref does. But it doesn't specially mention that this includes on the LHS of an assignment. It could do with a mention of
$aref->@* = (1, 2, 3); # same as @{ $aref } = (1, 2, 3)
just to reassure the reader.
(what follows is more of an opinion and might or might not be suitable for incusion in perlref) Perhaps a common usage of postfix on the LHS would be for
$aref->@* = foo();
This is, of course, not equivalent to
$aref = [ foo() ];
but it can be a good enough replacement in many cases, when you know $aref was undefined before, and is visually easier to read.
Where perlref section Postfix Dereference Syntax
Description The documentation is accurate to say that postfix deref works in all cases where block deref does. But it doesn't specially mention that this includes on the LHS of an assignment. It could do with a mention of
$aref->@* = (1, 2, 3); # same as @{ $aref } = (1, 2, 3)
just to reassure the reader.(what follows is more of an opinion and might or might not be suitable for incusion in perlref) Perhaps a common usage of postfix on the LHS would be for
$aref->@* = foo();
This is, of course, not equivalent to$aref = [ foo() ];
but it can be a good enough replacement in many cases, when you know$aref
was undefined before, and is visually easier to read.