Perl
Results 1 to 6 of 6

Thread: Perl

  1. #1
    Senior Member
    Join Date
    Aug 2002
    Posts
    239

    Perl

    Oy! I downloaded and installed ActivePerl for my WinXP box. I have no clue as how to save or run files:
    1. Do I save a script, do I save it as a MS-DOS batch or a .pl doc?
    2. When I do run the .pl document, it will usually say"File not found". No, I did not misspell the shortcut. Whats wrong?
    3. When I DO run a pl script via command prompt, it will unexpectedly, immediately close after a half-second

    I have read the tutorials- dont help! Help me pleez!
    It\'s 106 miles to Chicago, we\'ve got a full tank of gas, half a pack of cigarettes, it\'s dark and we\'re wearing sunglasses.

    Hit it!

  2. #2
    First you need to make sure there is a $PATH set in your autoexec.bat

    This must include the path for your perl interpriter.

    That is why you get file not found. Next, yes it is standard to save with pl extension, but you may save it with a txt extension and run it from DOS:

    C:\>perl script.txt

    And I don't know how but you need to associate pl files with your perl interpriter, which your installer should have done for you already.

    EDIT: you do not need to set your path if you move all your perl scripts to the directory that contains your perl interpriter:

    example:

    move your script to C:\Program Files\Perl\bin
    or it might be C:\perl\bin

    this way when you type the name of your script in the DOS prompt, it will be executed with the perl interpriter because by default DOS looks in the current directory first (I think)

    Note also that AFAIK autoexec.bat cannot be manualy editied in Windows ME as it will change it back.
    test

  3. #3
    Senior Member
    Join Date
    Nov 2001
    Posts
    4,786
    the way you say 'it closes abruptly' i get the impression your typing it into the run cammand instead of from a dos prompt. if thats the case enter 'command' in the run box to get the prompt. from there call your perl script.

    if im wrong my appoligies


    aj67my, active perl addes itself to the path statement and automatically registers itself with windows to run that type of file. Unless of course he didn't reboot, in which case the path might not be changed, i don't know if it does a set path thing.

    if files with the extention .pl appear as yellow sheets of paper with a bubble in the center, its installed right.
    Bukhari:V3B48N826 “The Prophet said, ‘Isn’t the witness of a woman equal to half of that of a man?’ The women said, ‘Yes.’ He said, ‘This is because of the deficiency of a woman’s mind.’”

  4. #4
    Senior Member
    Join Date
    Aug 2002
    Posts
    651
    You will have to type cmd to get to the command prompt, and then type perl (path to file or script) to open/run a .pl file. Yes, save them as a .pl file (this is how you will start out saving practice perl progs you write in the beginning probably, and open them with notepad, of course. You can do notepad (path to .pl file) to open an existing or notepad (filenameyouchoose.pl) to open a new one with the filename you choose. I hope this helps. If you need a good book for learning, try Perl for Beginners - great book, I am working on it myself.
    Opinions are like holes - everybody\'s got\'em.

    Smile

  5. #5
    Member
    Join Date
    Dec 2001
    Posts
    50
    well they are right.... but if you have 5.6.1 it does all the path configuration for you.but you will still have to run scripts from the DOS-promt...But if you start writing widgits(use Tk) then you can just click on the scripts without a command prompt...but here is a script to test.
    Code:
    #!/usr/bin/perl
    $perl = 'Power';
    print "Perl is $perl";
    but just run this code.first save it as <whatever).pl in the perl dir (c:\perl).from the command prompt type c:\perl>perl <whatever>.pl and the output should be.
    "perl is power"
    If not then we have a problem.
    [glowpurple]A_420_hacker_24::.\"A man without a computer is just a man, a man with a computer is a Admin\" ... \"If its not 4:20 on your clock, it\'s time to change the time\"..:Quotations from Larry Wall:.
    \"I think you didn\'t get a reply because you used the terms \"correct\" and \"proper\", neither of which has much meaning in Perl culture. :-) \"
    [/glowpurple]

  6. #6
    Senior Member
    Join Date
    Aug 2002
    Posts
    651
    Hey aj, showtime is asking about this for a WinXP box, that's why I said cmd. Just wanted to clear that up...thanks for reminding me though...
    Opinions are like holes - everybody\'s got\'em.

    Smile

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •