# New Ticket Created by  "Carl Mäsak" 
# Please include the string:  [perl #57758]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=57758 >


r30136:
$ ./perl6 -e '$/' # works

$ ./perl6 -e '"hi" ~~ /(i)/; $0' # works

$ ./perl6 -e '$0' # fails (in a strange way)
get_pmc_keyed() not implemented in class 'Undef'
[...]

I don't know whether the failure should eventually be silent or loud,
but I'm pretty sure it shouldn't involve get_pmc_keyed().

It clearly has something to do with indexing, since $0 is essentially
sugar for $/[0]. The same problem reoccurs when indexing other,
non-special scalars:

$ ./perl6 -e 'my @a; @a[0]' # works

$ ./perl6 -e 'my $a; $a[0]' # same problem
get_pmc_keyed() not implemented in class 'Undef'
[...]

Perl 5's motto here seems to be complaining as little as possible.

$ perl -Mstrict -we 'my $a; $a->[0]'
Useless use of array element in void context at -e line 1.
$ perl -Mstrict -we 'my $a; my $b = $a->[0]'
$ perl -Mstrict -we 'my $a; print $a->[0]'
Use of uninitialized value in print at -e line 1.

Reply via email to