Closed xsawyerx closed 4 years ago
@$foo -> @{$foo}
Non-braced dereference can be confusing:
$$foo
$#$foo
$$foo->{'bar'}
$ #$foo
$# $foo
$ # $foo
Instead, brace-based dereference is clear and consistent:
${$foo}
$#{ $foo }
$#{$foo}
${ $foo->{'bar'} }
${$foo}->{'bar'}
Non-braced dereference can be confusing:
$$foo
can be accidentally overlooked$#$foo
has a variable, a comment, and a dereference to an array top$$foo->{'bar'}
- what's the ref here?$ #$foo
- which one is it?$# $foo
- Is this two variables or a deref?$ # $foo
- Is this a deref or a comment after scalar sigil?Instead, brace-based dereference is clear and consistent:
${$foo}
cannot be overlooked$#{ $foo }
(or$#{$foo}
) shows what is happening${ $foo->{'bar'} }
or${$foo}->{'bar'}
are both clear