in reply to Hints to PERL

It seems to me that perl copies a string whenever you do anything, regardless of whether you really modify the copy later or not?
No, perl copies strings on assignment ($foo = $bar). Example:
#!/usr/bin/perl -- use strict; use warnings; my $str = "foo"; my $copy = $str; print "$copy $str\n"; nocopy($str); yescopy($str); print "$copy $str\n"; # now $str is foobar sub nocopy { $_[0] .= 'bar'; '...' } sub yescopy { my ($copy) = $_[0]; $copy = shift; $copy .= 'bar' } __END__ foo foo foo foobar

that you can hint PERL that you will not modify some variable and thus it removes the extra baggage that is otherwise required if you were to modify it etc?

You are probably thinking of constant and/or making variables readonly, which forces you not to write code that try to modify those variables, as a result there is no unneeded copying

... PERL ...

The Perl community likes to call it Perl, or perl, but not so much PERL, even if its a fun bacronym generator.

Replies are listed 'Best First'.
Re^2: Hints to PERL
by jvector (Friar) on May 19, 2009 at 19:54 UTC
    ... PERL ...
    The Perl community likes to call it Perl, or perl, but not so much PERL
    I realise this is off the main topic, but I have a couple of issues of (sic) THE PERL REVIEW (small caps, large caps, small caps) on my desk and it always jars me when I see that. Particularly because that may be something that a SoPW might come across while Seeking, and therefore it might seem to give validity to that format.

    (In an attempt to be fair to brian_d_foy, it is only thus on the cover. Inside, all references to the language look Perlish.)


    Because of the economic downturn, there will be no signatures this Christmas