Perl efficiency question 
Author Message
 Perl efficiency question

Does the following statement do an actual string copy, or just
some pointer swizzling?

        $s = "Hello, world!";
        $ary{"fieldname"} = $s;    # <-- copy by value or ref??

I know that in Perl5 you could use references instead, but I would
like to know what Perl4 and Perl5 do in this case (since this is
the case that is portable between both versions).

Thanks in advance.

--

--
..jkd



Tue, 15 Jul 1997 09:29:03 GMT  
 Perl efficiency question
: Does the following statement do an actual string copy, or just
: some pointer swizzling?
:
:       $s = "Hello, world!";
:       $ary{"fieldname"} = $s;    # <-- copy by value or ref??
:
: I know that in Perl5 you could use references instead, but I would
: like to know what Perl4 and Perl5 do in this case (since this is
: the case that is portable between both versions).

It copies the string.  This doesn't seem to be much of a problem in practice.

Larry



Fri, 18 Jul 1997 12:30:52 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Efficiency question

2. Question about efficiency

3. Perl5 objects & efficiency questions

4. some questions about array refs & efficiency

5. memory efficiency question

6. Quick Question on Efficiency

7. run-time eval efficiency question

8. Another question about memory efficiency

9. Time-efficiency question

10. Bizarre efficiency question.

11. Rookie question on efficiency of split/join vs loop

12. Interpreted or compiled -- Perl efficiency

 

 
Powered by phpBB® Forum Software