somnium has asked for the wisdom of the Perl Monks concerning the following question:

hello, i just registered not 10 minutes ago...ive been perl programmer for about 3 hours now (but i have been a c/c++ progger for about a year :P ) and i installed activeperl...and i made a file, with just the following:
#!c:/perl/bin/perl -w print "testing\n";
and it wont compile...here are the errors:
Backslash found where operator expected at test.pl line 1, near "rtf1\ +" Backslash found where operator expected at test.pl line 1, near "ansi\ +" Backslash found where operator expected at test.pl line 1, near "ansic +pg1252\" Backslash found where operator expected at test.pl line 1, near "deff0 +\" Backslash found where operator expected at test.pl line 1, near "f0\" Backslash found where operator expected at test.pl line 1, near "fswis +s\" syntax error at test.pl line 1, near "rtf1\" syntax error at test.pl line 1, near "}}" Execution of test.pl aborted due to compilation errors.
can anyone help me out?

Edit kudra, 2002-05-03 Changed title per ntc request

Replies are listed 'Best First'.
Re: *tips his hat*
by rob_au (Abbot) on Apr 10, 2002 at 01:30 UTC
    First of all Somnium ... Welcome to the Monastery!

    As for your script problem, I think you will find that this problem is because your editor has saved your source file in Rich Text Format (RTF) instead of plain text. To correct this, open the file again in your editor program and go to "Save As" and make sure that the file type in the "Save as Type" is set as either "Text Document" or "Plain Text".

    Good luck!

     

      ohhhhhhh thanks you guys, i didnt even think of that. cool
Re: *tips his hat*
by Rex(Wrecks) (Curate) on Apr 10, 2002 at 01:34 UTC
    Update: Doh! you are right about the RTF. However the below is still useful.

    try
    #!usr/bin/perl -w # Above line for *nix compatability print "testing\n";

    then perl test.pl at the commandline in windows.

    Windows doesn't know about the she-bang line, if you have the .pl extension associated with perl, you only have to type your file name.

    You also don't need the -w at the commandline in windows if you have it in the she-bang line as perl is smart enough to get the -w from the she-bang line even in windows. (at least the ActiveState perl is)

    "Nothing is sure but death and taxes" I say combine the two and its death to all taxes!
      This is true... until you write your first CGI script and tries to run it locally with say Apache or something. Then all of a sudden that line must be there.

      The line in the example is correct (and working) for ActiveState's default installation, but as long as the web server and all is on the same drive, #!/perl/bin/perl -w will be good enough. Although I do recommend installing in C:\usr instead to fit the standard #!/usr/bin/perl -w.

      Of course, if you never ever will test your CGI's locally, you can just ignore this post. :)


      You have moved into a dark place.
      It is pitch black. You are likely to be eaten by a grue.
Re: *tips his hat*
by Zaxo (Archbishop) on Apr 10, 2002 at 01:33 UTC

    You managed to save the file as rich text.Save again as ASCII.

    After Compline,
    Zaxo