Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Beginer's help

by proton15 (Initiate)
on Feb 15, 2014 at 23:16 UTC ( [id://1075065]=perlquestion: print w/replies, xml ) Need Help??

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

I can not seem to get past step 1 in perl. I have typed simple code from two manuals and they don't run. One question is if accessing my DOS start: I have: C:\Users\proton>_ while the manuals say C:\windows\desktop\. Is this going to make a big difference? How do you change it into the later form? Also, I have typed the following code into notepad and tried to run it in poerl. I've used the ending of the first line with -w; and without -w; no luck It simpy doesn't run contributing to frustration. Code follows

#!/usr/bin/perl print"Hello, World!\n";
Thanks, AHY

Replies are listed 'Best First'.
Re: Beginer's help
by davido (Cardinal) on Feb 16, 2014 at 01:30 UTC

    Under windows you would follow these steps:

    • Install Perl (ActiveState, or Strawberry, for example) as per the vendor's instructions.
    • At the DOS prompt (is that what they still call it?) verify that perl, the executable works, by typing perl -v. If that gives you a Perl version number, perl works, and seems to be included in your path properly.
    • Type your program in using a text editor. The one you demonstrated for us should be fine. Save it somewhere you can find it later. Give it a name you will remember. Perhaps, "mytest.pl"
    • At the DOS prompt, make sure you're in the directory where mytest.pl was saved, and type this: perl mytest.pl

    It's been awhile since I did much with Windows, but that really ought to work for you. If it doesn't, let us know what step fails, and what messages you get.


    Dave

Re: Beginer's help
by tobyink (Canon) on Feb 16, 2014 at 09:10 UTC

    "I have: C:\Users\proton>_ while the manuals say C:\windows\desktop\. Is this going to make a big difference? How do you change it into the later form?"

    If you don't know what this difference signifies, and how it might affect things, then I'd suggest you have some other learning to do before you learn Perl.

    In particular, you should be able to answer these questions, otherwise you'll probably find even running Perl scripts at the command line difficult:

    • What's the difference between an absolute file path, and a relative file path?
    • What does the concept of a "current working directory" mean? How can I find out the current working directory from the command line? And how can I change it?
    • How does the current working directory affect the interpretation of relative file paths?
    use Moops; class Cow :rw { has name => (default => 'Ermintrude') }; say Cow->new->name
Re: Beginer's help
by Cristoforo (Curate) on Feb 15, 2014 at 23:52 UTC
    if accessing my DOS start: I have: C:\Users\proton>_ while the manuals say C:\windows\desktop\. Is this going to make a big difference
    It shouldn't, depends on how you loaded perl. If it is ActiveState, it should have updated your path variable with the location of your perl.

    You might want to get an editor made for programming instead of using Notepad (that comes with Windows). I use Crimson Editor and it does what I need. (You can also download it here.)

    Update Seeing the response by syphilis, are you running the program by typing at the command line perl myprogram.pl?

      I wasn't running the first perl. I tried to at various times with it and it didn't run.

      proton
Re: Beginer's help
by syphilis (Archbishop) on Feb 15, 2014 at 23:47 UTC
    Code follows

    What happens when you try to run that code ?
    What command do you run ? ... and what output do you get ?

    Cheers,
    Rob
Re: Beginer's help
by Anonymous Monk on Feb 16, 2014 at 09:26 UTC
      Try help prompt to change the prompt
      That is particularly unhelpful. It is the same (standard on Windows) prompt, only showing a different path.

      CountZero

      A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

      My blog: Imperial Deltronics

        That is particularly unhelpful. It is the same (standard on Windows) prompt, only showing a different path.

        Ok?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1075065]
Approved by Old_Gray_Bear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2024-04-16 09:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found