The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
use PDL::LiteF;
use PDL::NiceSlice;
   
$a = sequence(10);

print "\n",'source $a'.'((4)) translated -> $a((4))',"\n";
print "Result ",$a((4)),"\n\n";

print 'alternative syntax: $a->'.'((4)) translated -> $a->((4))',"\n\n";

print 'source $a'.'(1:4) .= 2; translated -> $a(1:4) .= 2;',"\n"; # this should be rewritten

($tmp = $a(1:4)) .= 2;

print "Result: $a","\n\n";

print << 'EOP';

The arglist is split at commas but commas within
matched brackets are protected. That should allow
function invocations etc within the arglist:

EOP

print '$a'.'(1:end(0,22)) -> $a(1:end(0,22))',"\n\n";

print "recursive invocation is also supported:\n";
print '$a'.'(1,$b'.'(0:22)) -> $a(1,$b(0:22))',"\n\n";

no PDL::NiceSlice;


print << 'EOP';

Now we have switched off source filtering by issuing

     no PDL::NiceSlice;

Therefore, the next slice expression should not be touched:

EOP

# this shouldn't be touched
print 'Source $a'.'(1:4) translation -> $a(1:4)',"\n\n";