Created
April 22, 2012 06:29
-
-
Save Siddhant/2462010 to your computer and use it in GitHub Desktop.
modifying readonly arrays
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use v6; | |
{ | |
my $x = 2; | |
my @x = 2, 3, 4; | |
say foo(@x); | |
say bar($x); | |
} | |
sub foo(@z) { | |
@z.pop; #is legal; why? | |
return @z; | |
} | |
sub bar($z) { | |
$z = $z + 2; #is illegal | |
return $z; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment