use PDL::LiteF;
use PDL::NiceSlice;
   
$x = sequence(10);

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

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

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

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

print "Result: $x","\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 '$x'.'(1:end(0,22)) -> $x(1:end(0,22))',"\n\n";

print "recursive invocation is also supported:\n";
print '$x'.'(1,$y'.'(0:22)) -> $x(1,$y(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 $x'.'(1:4) translation -> $x(1:4)',"\n\n";
