mirror of
https://github.com/Perl/perl5.git
synced 2026-01-26 16:39:36 +00:00
[perl #117531] Deparse elements of %# correctly
They can only be referred to as $# {foo} and ${#}{foo}, not as $#{foo},
as that means $#foo.
This commit is contained in:
parent
9b12f83b0b
commit
bcbe2b27bd
4
dist/B-Deparse/Deparse.pm
vendored
4
dist/B-Deparse/Deparse.pm
vendored
@ -3515,7 +3515,9 @@ sub elem {
|
||||
}
|
||||
if (my $array_name=$self->elem_or_slice_array_name
|
||||
($array, $left, $padname, 1)) {
|
||||
return ($array_name =~ /->\z/ ? $array_name : "\$" . $array_name)
|
||||
return ($array_name =~ /->\z/
|
||||
? $array_name
|
||||
: $array_name eq '#' ? '${#}' : "\$" . $array_name)
|
||||
. $left . $idx . $right;
|
||||
} else {
|
||||
# $x[20][3]{hi} or expr->[20]
|
||||
|
||||
3
dist/B-Deparse/t/deparse.t
vendored
3
dist/B-Deparse/t/deparse.t
vendored
@ -1410,3 +1410,6 @@ use feature 'state', 'lexical_subs';
|
||||
no warnings 'experimental::lexical_subs';
|
||||
state sub f {}
|
||||
print f();
|
||||
####
|
||||
# Elements of %# should not be confused with $#{ array }
|
||||
() = ${#}{'foo'};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user