develooper Front page | perl.perl5.porters | Postings from October 2004

Re: optimization idea

Thread Previous | Thread Next
Elizabeth Mattijsen
October 25, 2004 13:23
Re: optimization idea
Message ID:
At 5:10 PM -0500 10/21/04, David Nicol wrote:
>when a lexical variable is not written to between getting assigned
>from a constant and getting interpolated, replace the value in the
>string at compile time
>sub statename{
>    my $name = 'david';
>    return "hello my name is $name";

Wouldn't you need to add taking a ref of the var, to invalidate this 
optimization?  Specifically for this case:

sub statename {
     my $name = 'david';
     ${\$name} = 'liz';
     return "hello, my name is $name";


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About