Does concatenation need "space" in Perl?

I did not find any explanation from google on the issue, although it is possible that I did not use the correct search word.

script1:

#!usr/bin/perl #concatenation2.pl use warnings; use strict; print"Four sevens are",4*7 ,"\n"; print"Four sevens are".4*7 ."\n"; 

Script2:

 #!usr/bin/perl #concatenation2.pl use warnings; use strict; print"Four sevens are",4*7,"\n"; print"Four sevens are".4*7."\n"; 

Output for script1:

 Four sevens are28 Four sevens are28 

Ok, so I (found out) should have a place before closing the double quote. However, the exit for script2 ends with an error message:

 string found where operator expected at concatenate2.pl line 6, near "7."\n"" (Missing operator before "\n"?) syntax error at concatenate2.pl line 6, near "7."\n"" 

Nowhere can I find an explanation of why there should be a space between the numbers and. in script2, while no space is required between numbers, I currently rely on google and free perl books to help me choose a language. Any help (general recommendations for this kind of nuances) would be greatly appreciated. Thanks.

+4
source share
1 answer

7. is the number for perl lexer, for example 3.1415926535 . To avoid confusion, separate the dot from the previous number with a space: "the answer is " . 4*7 . " times more complicated" "the answer is " . 4*7 . " times more complicated" "the answer is " . 4*7 . " times more complicated" .

+11
source

All Articles