in reply to Re: Re: Re: How Perl Optimize your code & some code TIPS ;-P
in thread How Perl Optimize your code & some code TIPS ;-P

No really, it's the same. The null operations are never seen by runtime perl and only exist in the optree as artifacts. I took the output from both of your lines, stripped out the null operations and they are 100% identical. Incidentally B::Concise provides better output than B::Terse.

$ perl -MO=Terse -e '$var = "String"; $var = "foo$var"' LISTOP leave [1] OP enter COP nextstate BINOP sassign SVOP const PV "String" SVOP gvsv GV *var COP nextstate BINOP sassign BINOP concat [1] SVOP const PV "foo" SVOP gvsv GV *var SVOP gvsv GV *var $ perl -MO=Terse -e '$var = "String"; $var = "foo" . $var' LISTOP leave [1] OP enter COP nextstate BINOP sassign SVOP const PV "String" SVOP gvsv GV *var COP nextstate BINOP sassign BINOP concat [1] SVOP const PV "foo" SVOP gvsv GV *var SVOP gvsv GV *var

Seeking Green geeks in Minnesota