Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re: Re: Passing a very large string by reference to a c libraryby dino (Sexton) |
on Jul 16, 2001 at 15:22 UTC ( [id://96992]=note: print w/replies, xml ) | Need Help?? |
This stems from my (mistaken) belief that perl copies variables
on subroutine calls. It appears that this is not true ;-). It seems that the copying may take place
during the standard assignment in the subroutine body which can be avoided with a little thought. eg: &find_index($key, \$bigstring); sub find_index { my ($key, $rbigstring) = @_; becomes: &find_index($key, $bigstring); sub find_index { my ($key) = $_[0]; my ($rbigstring) = \$_[1]; This has the added benefit of making the sub call for both c and perl the same. Thanks for your help dino
In Section
Seekers of Perl Wisdom
|
|