Comparing Python to Perl and Ruby

use strict;use warnings;sub func {# You've got to be kidding parameter passing.# Perl 6 intends to fix this.my($x,$arrayRef)=@_;my$i=2;# This declares a new local variable++$x;$arrayRef->[0]=4;#Modify the callers array.print"$x\n";my$newvar='abc';# This declares a new local variablereturn1;}my$i=1;# Choose the right variable prefix for a listmy@array=(1,2);#Passing an array by reference is uglymy$x= func(1,\@array);#print "$newvar\n"; # This won't compileprint"i = $i\n";# i is 1# You're kidding, I need to change the prefix$array[1]=0;print"$array[0] $array[1]\n";# prints 4 0

use v6;sub func($x is rw,@array is rw,$z is rw ='Cool! Default value'){my$i=2;# This declares a new local variable++$x;# $x and @array paremeters are defined as rw (readwrite, # instead of default ro) so this compile@array[0]=4;# Modify the callers array.
say "$x $z";my$newvar='abc';# This declares a new local variablereturn1;}my$i=1;# Choose the right variable prefix for a listmy@array=1,2;my$x= func(1,@array);#say $newvar; # This won't compile
say "i is $i";# i is 1@array[1]=0;
say "@array";# prints 4 0