Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

50 lines (39 sloc) 0.662 kb
use v6;
use Test;
# L<S09/Autovivification/>
plan 7;
{
my $foo = 0;
$foo++;
is $foo, 1, 'lvalue $var works';
}
{
my $foo = [0];
$foo[0]++;
is $foo[0], 1, 'lvalue $var[] works';
}
{
my $foo = [[0]];
$foo[0][0]++;
is $foo[0][0], 1, 'lvalue $var[][] works';
}
{
my @foo = [0];
@foo[0][0]++;
is @foo[0][0], 1, 'lvalue @var[][] works';
}
{
is ++[[0]][0][0], 1, 'lvalue [[]][][] works';
}
{
my $foo = {a => [0]};
$foo<a>[0]++;
is $foo<a>[0], 1, 'lvalue $var<>[] works';
}
#?pugs skip "Can't modify constant item: VInt 0"
{
my %foo = (a => [0]);
%foo<a>[0]++;
is %foo<a>[0], 1, 'lvalue %var<>[] works';
}
# vim: ft=perl6
Jump to Line
Something went wrong with that request. Please try again.