http://qs1969.pair.com?node_id=1143959


in reply to Re: Typo or on purpose? Variable instantiation with string concatenation operator
in thread Typo or on purpose? Variable instantiation with string concatenation operator

Not relevant for this specific case, but there is a difference if the thing being appended is a number:
$ perl -e'use Devel::Peek; my $x = 5; Dump($x) ; my $y .= 5; Dump($y); +' SV = IV(0x2fc84) at 0x2fc88 REFCNT = 1 FLAGS = (PADMY,IOK,pIOK) IV = 5 SV = PV(0x13838) at 0x2fcd8 REFCNT = 1 FLAGS = (PADMY,POK,pPOK) PV = 0x2ac18 "5"\0 CUR = 1 LEN = 12

i.e. .= will stringify on assigment.

Replies are listed 'Best First'.
Re^3: Typo or on purpose? Variable instantiation with string concatenation operator
by ikegami (Patriarch) on Oct 07, 2015 at 19:37 UTC
    Good point. I'd use the following if I wanted to force stringification:
    my $str1 = "".$self->sanitizeString($input1);