Skip to content

Instantly share code, notes, and snippets.

@Siddhant
Created April 22, 2012 06:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Siddhant/2462010 to your computer and use it in GitHub Desktop.
Save Siddhant/2462010 to your computer and use it in GitHub Desktop.
modifying readonly arrays
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