Jump to content
  • Advertisement
Sign in to follow this  
WheelsRCool

Getting Perl to Work

This topic is 4307 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey, I am trying to get Perl to work on my computer so I can start practising with that some. I downloaded Perl from ActiveState.com; I downloaded the ActivePerl MSI version for Windows XP. After installing it, I went into Wordpad and typed out the following: #!/usr/local/bin/perl print "Hi there!\n"; Then I saved it into a file named first.pl. Then I went into the command prompt, went to the directory containing the little program, then I typed, perl first.pl . Well a whole bunch of lines came up, saying the following: Backlash found where operator expected at first.pl line 1, near "rtf1\" Backlash found where operator expected at first.pl line 1, near "ansi\" Backlash found where operator expected at first.pl line 1, near "ansicpg1252\" Backlash found where operator expected at first.pl line 1, near "deff0\" Backlash found where operator expected at first.pl line 1, near "f0\" Backlash found where operator expected at first.pl line 1, near "froman\" Backlash found where operator expected at first.pl line 1, near "f1\" Backlash found where operator expected at first.pl line 1, near "fswiss\" syntax error at first.pl line 1, near "rtf1\" syntax error at first.pl line 1, near "f1\" syntax error at first.pl line 1, near "}}" Execution of first.pl aborted due to compilation errors I have read that the line #!/usr/local/bin/perl is standard for all perl programs, but I also read it can vary system to system, now I'm confused. What am I doing wrong here? Thanks, ---Wheels---

Share this post


Link to post
Share on other sites
Advertisement
/usr/bin/perl is a Unix-style directory. I've never used Perl, but you could try replacing that line with a Windows directory such as #!C:\Program Files\perl. Check your Perl documentation for more information.

Share this post


Link to post
Share on other sites
The first line just gives the location of the perl interpreter. "/usr/local/bin/perl" is the standard unix directory where perl lives. Since your'e on windows, it will probably be:

#!C:/perl

Share this post


Link to post
Share on other sites
Argh, it still doesn't wanna work.

For the source code of a test program that came with it, the top is like this:

#! ./perl

and it executes from the cmd prompt.

The code for a .pl file called "Example" consists solely of a print line and when I go into the directory and execute it, it works fine. I copy-pasted that same line into my program file, saved it, tried to execute it from the proper directory, and still no go.

Share this post


Link to post
Share on other sites
Quote:
Original post by WheelsRCool
Backlash found where operator expected at first.pl line 1, near "rtf1\"


You saved your code as RTF. Try plain text. :)


Quote:

I have read that the line #!/usr/local/bin/perl is standard for all perl programs, but I also read it can vary system to system, now I'm confused.


AFAIK The Perl interpreter should ignore the shebang (the #!... line) on Windows. You'll have to call the interpreter yourself (as in 'perl foo.pl') or to associate the extension with the Perl interpreter. In either case, the shell doesn't have to determine the eventual interpreter.


Hope this helps.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!