Created
October 14, 2011 16:34
-
-
Save ktat/1287614 to your computer and use it in GitHub Desktop.
add_to_items
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
# 問題では、add_to_items($value, \@array); でしたので、書き換わりません。 | |
# と、指摘いただきました。 | |
{ | |
my ($value, $array_ref) = (1, [1,2,3,4]); | |
add_to_items($value, $array_ref); | |
print join ",", @$array_ref; | |
# 2,3,4,5 | |
} | |
sub add_to_items { | |
my($value, $array_ref) = @_; | |
$_[1] = [ map { $_ + $value } @{$array_ref} ]; | |
return; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment