develooper Front page | perl.perl5.porters | Postings from March 2000

Re: [ID 20000330.052] Use of uninitialized value in concatenation (.)

March 30, 2000 19:58
Re: [ID 20000330.052] Use of uninitialized value in concatenation (.)
Message ID:
Tom Christiansen writes:
 > That is, however, what's happening:
 > % perl -MO=Deparse,-q -e '@scalar = @array = (1..10); print "this $scalar and that @array\n"'
 > @scalar = (@array = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10));
 > print 'this ' . $scalar . ' and that ' . join($", @array) . "\n";

Many years ago when I started doing Perl I picked up the idea that it
is always more efficient to do double-quote interpolation than
spelling it out with '.' between each element.  Of course, that was in
the days of Perl4.  I assume that is no longer a concern?  Was it
ever, or was I misinformed?  I've done a lot of Perl hacking, but have
never spent time digging around in the actual interpreter itself.

I also was told that if there are no variables to be interpolated to
always use single quotes rather than double quotes, as the extra
parsing required was expensive.  Is/was this true?


William R Ward
The secret of being creative is making something that's not very new
but just a little bit different in the right direction - Marvin Minsky Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About