I read several postings here about getting the error message -
can't find string terminator "" anywhere before EOF ...
can't find string terminator "'" anywhere before EOF ...
I don't think I really understand it, although the take-home message is not to use single quotes. So okay, I will try NOT to use single quotes. But still, if possible, could someone help me understand the differences between the two scripts, in terms of how Perl sees them differently
#!/usr/bin/perl -w
#backwhacking
print "c:\\WINNT\\Profiles\\\n";
print 'c:\WINNT\Profiles\ ', "\n";
#!/usr/bin/perl -w
#backwhacking
print "c:\\WINNT\\Profiles\\\n";
print 'c:\WINNT\Profiles\', "\n";
The first script runs fine with the output
c:\WINNT\Profiles
c:\WINNT\Profiles
whereas the second script gave me the same error code about not able to find script terminator "'"
And is there any "reason" why Perl programming needs to distinguish between with or without a space with single quotes? Sorry, but it seems somewhat trivial to a non-computer science person.
' style quotes use backslash to escape ' character.
So: print '\''
; will print ' character, and not \' string.
when you print 'whatever\ ' - it will print >whatever < - with space at the end. But if you do:
print 'whatever \'
this is not terminated string, because the backslash escapes '. So the following , "\n";
are treated as part of '' string.