PERL HELP!!!!!!

My older brother recently purchused me a book Perl, because i do a bit of webbased programing...like xhtml, javascript and so on. With all the other ones...you make it in notepad and save it as .html

but what do u do with perl...how can i make this lil program work

perl -e "print 'hello, world!';"

where do i save it, and what as and what do i open it with???

THANK YOU VERY MUCH FOR YOUR TIME :)

Comments

  • : My older brother recently purchused me a book Perl, because i do a bit of webbased programing...like xhtml, javascript and so on. With all the other ones...you make it in notepad and save it as .html
    :
    : but what do u do with perl...how can i make this lil program work
    :
    : perl -e "print 'hello, world!';"
    :
    : where do i save it, and what as and what do i open it with???
    :
    : THANK YOU VERY MUCH FOR YOUR TIME :)

    When you use the syntax
    perl -e "print 'hello, world!';"
    This is actually running to program. There is a command called perl which runs perl commands from the command line. So there is no need to save because you are running from command line.
    Now when you have larger files with a lot more commands, then you will have to use a text editor. I've never wrote perl on Windows, but I'm sure notepad is fine. You can save it as a text file with the .pl extension and it should be ok. I'm sure some Windows guys will reply with a better comment.
    For Linux, any text editor will do as long as you save it with .pl and the shebang line (also required in windows).
    I hope this helps.

    X
  • [b][red]This message was edited by erikina at 2003-6-21 2:35:59[/red][/b][hr]
    : : My older brother recently purchused me a book Perl, because i do a bit of webbased programing...like xhtml, javascript and so on. With all the other ones...you make it in notepad and save it as .html
    : :
    : : but what do u do with perl...how can i make this lil program work
    : :
    : : perl -e "print 'hello, world!';"
    : :
    : : where do i save it, and what as and what do i open it with???
    : :
    : : THANK YOU VERY MUCH FOR YOUR TIME :)
    :
    : When you use the syntax
    : perl -e "print 'hello, world!';"
    : This is actually running to program. There is a command called perl which runs perl commands from the command line. So there is no need to save because you are running from command line.
    : Now when you have larger files with a lot more commands, then you will have to use a text editor. I've never wrote perl on Windows, but I'm sure notepad is fine. You can save it as a text file with the .pl extension and it should be ok. I'm sure some Windows guys will reply with a better comment.
    : For Linux, any text editor will do as long as you save it with .pl and the shebang line (also required in windows).
    : I hope this helps.
    :
    : X
    :
    ----------------------------------------------------------------------

    when you say "it runs it commands from the command line"...what program are should i use

    and when i save it as a .pl what program do i open it in
    Thank you once again


  • : : Now when you have larger files with a lot more commands, then you
    : : will have to use a text editor. I've never wrote perl on Windows,
    : : but I'm sure notepad is fine. You can save it as a text file with
    : : the .pl extension and it should be ok. I'm sure some Windows guys
    : : will reply with a better comment.
    Notepad works fine for me. The extension .pl helps identify it as a Perl script and after installing ActivePerl windows will associate .pl files with it. (See below for more on ActivePerl).

    : : For Linux, any text editor will do as long as you save it with .pl
    : : and the shebang line (also required in windows).
    The shebang line sometimes matters on Windows if you're serving pages through a web server that cares (and I think this may be a sketchy case), though it doesn't really serve so much purpose as it does under UNIX based OSes. Windows itself doesn't look at the first line of a file to see what interpreter to use. It certainly does no harm to put it in though.

    : when you say "it runs it commands from the command line"...what
    : program are should i use
    Go to the command prompt and just type:-

    perl -e "print 'Hello World!';"

    And press enter. It should display Hello World! on the screen. However, you may get an error about the perl program not being found. If that happens, you need to install Perl on your computer. Check out http://www.activestate.com/ and look for Active Perl. It's a free download.

    : and when i save it as a .pl what program do i open it in
    You need to go to the command prompt again and type:-

    perl Something.pl

    To run your script (if it's called Something.pl). For that to work out you need to be in the same folder as your script is in and Perl must be in the system path (it will be once you install ActivePerl though there is a chance you may have to restart your computer).

    Be aware, Perl programs run server side, not client side. That means that they run on the web server and print HTML code that is delivered to the web browser by the web server. So it's very different from your JavaScript. I advise you write some simple Perl scripts that run at the command line on your PC to get to know the langauge a bit before you delve into the world of CGI (web stuff) though.

    Hope this helps,

    Jonathan

    ###
    for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
    (tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
    /(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");

  • I've downloaded perl thing from active state....and it created a folder called "perl" and i've tryied saving my perl program in that folder and it has the "perl icon" of that yellow dot thingy...but when i open it it just filckers on. I've also saved it in the subfolder "bin" and the same thing happened

    Theres this program called "perl580" and its the only program i can find which doesn't flicker on...
    i tried acctuly righting my program in it...but when i hit enter it goes to another line and i can't find any command to "exit" of try my script

    I'm not sure if i downloaded the wrong perl

    btw the book i've got tells me how to do it...but the urls it gives are outdated
  • : I've downloaded perl thing from active state....and it created a
    : folder called "perl" and i've tryied saving my perl program in that
    : folder and it has the "perl icon" of that yellow dot thingy...but
    : when i open it it just filckers on. I've also saved it in the
    : subfolder "bin" and the same thing happened
    For the umpteenth time, like both myself and XFactor have told you, you should run your script from the command prompt. Otherwise you'll never see the output as your program will probably complete and the window close when it's done.

    : Theres this program called "perl580" and its the only program i can
    : find which doesn't flicker on...
    : i tried acctuly righting my program in it...but when i hit enter it
    : goes to another line and i can't find any command to "exit" of try
    : my script
    Nah, you don't really want to be doing that. To run your program after entering it you simply press Ctrl+Z then hit enter, but again, it will flicker away if you ain't started it from the command prompt.

    : I'm not sure if i downloaded the wrong perl
    Haha, no, you've got the right Perl. :-) You just need to use the command line to run your program.

    : btw the book i've got tells me how to do it...but the urls it gives
    : are outdated
    Ah well, you've got what you need now. Just go to the comamnd prompt (normally in Accessories section of Programs on Start Menu), type perl scriptname.pl, press enter and it should all work out nicely for you. Unless of course, you've got a problem with your script.

    Hope this helps,

    Jonathan

    ###
    for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
    (tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
    /(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");

  • : My older brother recently purchused me a book Perl, because i do a bit of webbased programing...like xhtml, javascript and so on. With all the other ones...you make it in notepad and save it as .html
    :
    : but what do u do with perl...how can i make this lil program work
    :
    : perl -e "print 'hello, world!';"
    :
    : where do i save it, and what as and what do i open it with???
    :
    : THANK YOU VERY MUCH FOR YOUR TIME :)
    :


    First things first... You need to make sure you have Perl installed on your machine. If you don't, you can get it at activestate.com. Once you have it installed, I recommend typing the following into a text editor (MS-DOS EDIT.EXE or Windows Notepad):
    [code]
    #usr/bin/perl

    print "Hello, World
    ";
    [/code]
    Then save this file as, 'hello.pl'.

    To run the program simply open up a DOS prompt, (start > programs > accessories >) then use the cd command to get to the correct directory of where the file is located, then type in:
    [code]
    perl hello.pl
    [/code]
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories