
yanivr78
Novice
Mar 15, 2013, 2:57 AM
Post #1 of 6
(1274 views)
|
MAP function and its affect....
|
Can't Post
|
|
Hi all, I have two lists, @a and @b. after running a function on @b using the below :
#!/usr/bin/perl # MAP = returns a list of Regexp strings(similar to grep) @a = (1,2,3,1.2); @b = map($_ *= 2,@a); # first add *2 to each number from @a print "\n@a\n"; print "\n@b\n"; I print the lists, and I've found that @a was changed as well from some reason.
@a: 2 4 6 2.4 @b: 2 4 6 2.4
Can you explain why ?
(This post was edited by yanivr78 on Mar 15, 2013, 2:59 AM)
|