tags:

views:

208

answers:

3

I have a long-ish Perl script that runs just fine, but always gives this warning:

Can't find string terminator '"' anywhere before EOF at -e line 1

I've read elsewhere online that this is because of a misuse of single or double quotes and the error generally stops the script from running, but mine works. I'm pretty sure I've used my quotes correctly.

Is there anything else that could cause this warning?

EDIT: I'm running the script via TextMate, which may be spawning a new Perl process to run my script.

I actually get the error when I run simple scripts as well, like this one:

#!/usr/bin/perl -w
use strict;
use warnings;

print "Hello world.";
+2  A: 

The "at -e line 1" bit means it's coming from a one-liner. I suspect your long script is somewhere starting a separate perl process (possibly indirectly), and that perl is what is giving the error (and not doing whatever it is supposed to do.)

ysth
That actually makes some sense. I'm running the script through TextMate, so it might be spawning a separate Perl process to run my script...
Andrew
A: 

Start the debugger by doing

perl -d ./youscript.pl

Then keep pressing n[ENTER] (or just ENTER after you press n once) until you see the warning - the line that was just executed is your culprit. n stands for the next debugger directive btw.

Artem Russakovskii
+3  A: 

Yes, you are right, your script does that in TextMate when I try it too.

Simple solution: don't run it using TextMate; just use the command line:

cd Projectdirectory
chmod +x myscript.pl
./myscript.pl
Hello world

More complex solution: tell TextMate that their application is broken and wait for them to fix it. The error is coming from some other Perl script that TextMate is invoking. Even a completely blank file run as Perl in TextMate fails with this error.

-Alex

Sweet. Fortunately it doesn't break the script in TextMate; it just gives that ominous warning. Hopefully some day they fix it.
Andrew
draegtun