> 
> I'm sorry, but I think you are simply wrong here.  If I call a perl
> function or an XS routine with a variable as an argument it is passed by
> reference.  There is *no* copy.
> 
> A simple proof:
> 
>       sub hack {
>               $_[0] = 'a new string';
>       }
> 
>       $a = 'an old string';
>       hack $a;
>       print $a;

Yep you're right.  I'm used to passing by reference because it's just easier to
avoid making copies of the references visa vi shift and you don't have to worry
about it.  I mean you could do:
sub refcall {
        my $something=\$_[0];
}
to avoid the copy I guess..., but that's just weird.  Easier to just call it by
\$myvariable.  Hmm.., good point, and well taken.  (hamster in brain whipped
slightly for poor case creation..., ran a few test scripts prior to posting,
but should have noted the copy when shifting off the args, implicit deep copy
for '='s is still a strange thing for a primarily c programmer...)

Thanks,
Shane.

Reply via email to