in reply to Hints to PERL
#!/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 | |
by Anonymous Monk on May 20, 2009 at 03:55 UTC |