You can always test your script's syntax with
perl -c like so ...
plankton@chum-bucket:~$ cat test.pl
#!/usr/bin/perl -w
use strict;
my $var = 'hello world';
print "$var\n";
plankton@chum-bucket:~$ perl -c test.pl
test.pl syntax OK
plankton@chum-bucket:~$ cat test2.pl
#!/usr/bin/perl -w
use strict;
my $var = 'hello world';
print $var\n";
plankton@chum-bucket:~$ perl -c test2.pl
Backslash found where operator expected at test2.pl line 7, near "$var
+\"
(Missing operator before \?)
String found where operator expected at test2.pl line 7, at end of lin
+e
(Missing semicolon on previous line?)
Can't find string terminator '"' anywhere before EOF at test2.pl line
+7.
It even tells what's ... wrong most of the time. What error message do you get?