Are Perl strings immutable? -


After text itemprop = "text">

What is happening behind the scenes when I do a combination on a string?

  my $ minor = 'small'; $ Small = 'Cake';  

What is Pearl specified effectively creating a new string, then the correct variable reference, or pearl string is always unstable nature?

The motivation of this question was to discuss a discussion with a colleague that said scripting languages ​​could use invariant strings.

Pearl wire are instability Perl automatically creates new buffers, if If necessary, use

  Devel :: crop .; My $ small = 'small'; ($ Less) dump; Dump ($ less = 'cake'.); Dump ($ short = ""); 0x284766f4 REFCNT = 1 SV = PV (0x28403038) at Flags = 0 (Piadimwai, PoK Peepioke) PV = 0x28459078 "small" \ 0 Q = lane 5 = 8 SV = PV (0x28403038) REFCNT = 1 flags = on 0x284766f4 (Padmi , POK, pPOK) PV = 0x28458120 "shortcake" \ 0 CUR = 9 LEN = 12 SV = 0x284766f4 REFCNT PV (0x28403038) = 1 FLAGS = on (PADMY, POK, pPOK) PV = 0x28458120 "" \ 0 CUR = 0 LEN = 12  

Note that a new buffer is allocated in the third case.


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -