> Wagner, David --- Senior Programmer Analyst --- CFS wrote:
> 
>> You pass as a refernce as ni
>> called_sub(\...@d);
>> Now when you update, you are updating @d and not a copy.
> 
> No need to use a reference for that:
> 
> perl -wle '
> 
>      sub inc{ ++$_ for @_ }
> 
>      my @x = 1 .. 5;
> 
>      inc @x;
> 
>      print "@x";
> '
> 2 3 4 5 6


FYI, the reason we wanted a reference was because the data set might end up
being huge.

Uh, come to think of it, I'm surprised your script does what it does.  I'd
have thought that the changes made internal to inc would've stayed there
since they're not being "returned".  This bothers me a little...

- Byan



-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to