Deparse "${#}a"
authorFather Chrysostomos <sprout@cpan.org>
Sun, 18 Sep 2011 05:42:58 +0000 (22:42 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Sun, 18 Sep 2011 05:42:58 +0000 (22:42 -0700)
dist/B-Deparse/Deparse.pm
dist/B-Deparse/t/deparse.t
pod/perldelta.pod

index 7936fcd..28da808 100644 (file)
@@ -1297,13 +1297,16 @@ sub stash_variable {
        return "$prefix$name";
     }
 
-    if (defined $cx && $cx == 26) {
-       if ($prefix eq '@' && $name =~ /^[^\w+-]$/) {
+    if ($name =~ /^[^\w+-]$/) {
+      if (defined $cx && $cx == 26) {
+       if ($prefix eq '@') {
            return "$prefix\{$name}";
        }
-    }
-    if ($prefix eq '$#' && $name =~ /^[^\w+-]$/) {
+       elsif ($name eq '#') { return '${#}' } #  "${#}a" vs "$#a"
+      }
+      if ($prefix eq '$#') {
        return "\$#{$name}";
+      }
     }
 
     my $v = ($prefix eq '$#' ? '@' : $prefix) . $name;
index 92f8ae0..e527b99 100644 (file)
@@ -772,3 +772,7 @@ my @x;
 @x = ($#{(}, $#{)}, $#{[}, $#{{}, $#{]}, $#{}}, $#{'}, $#{"}, $#{,});
 @x = ($#{<}, $#{.}, $#{>}, $#{/}, $#{?}, $#{=}, $#+, $#{\}, $#{|}, $#-);
 @x = ($#{;}, $#{:});
+####
+# ${#} interpolated (the first line magically disables the warning)
+() = *#;
+() = "${#}a";
index 25ef87c..9820c0a 100644 (file)
@@ -174,7 +174,7 @@ L<Archive::Tar> has been upgraded from version 1.76 to version 1.78.
 
 L<B::Deparse> has been upgraded from version 1.07 to 1.08.
 
-It now correctly deparses C<$#{/}>.
+It now correctly deparses C<$#{/}> and C<qq(${#}a)>.
 
 =item *