Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Confused Newbie

by jbdowns (Initiate)
on May 27, 2003 at 17:31 UTC ( [id://261061]=perlquestion: print w/replies, xml ) Need Help??

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

Judging from the complexity of the other posts I won't feel bad if this gets looked over. I first touched a computer a year ago due to work. So don't giggle too much at this question. One of our admins told me that if I really wanted to have fun on cumputers then I should ditch Windows move to Linux and start learning Perl- I now run Linux, but I can't seem to even get "Hello, world!" to run when I try opening it in a terminal. I have "Learning Perl" from O'Reilly- but he seems to skip the execution part of getting Perl to run this script. I assumed Perl was standard on Linux 9- am I wrong? Here is what I wrote
#! usr/bin/perl print "Hello, world!\n";
A screen pops up and quickly disappears where I can't even distinguish what it says.

Thanks,
Jason

Edit by tye, add CODE tags

Replies are listed 'Best First'.
Re: Confused Newbie
by Limbic~Region (Chancellor) on May 27, 2003 at 17:38 UTC
    Jason,
    It sounds like your script did indeed run. The problem is that it looks like you are not running it from "the command line", but from within a GUI environment. As soon as the program completes, the window vanishes. To test my theory, try adding the following line at the end of the script.
    #!/usr/bin/perl -w use strict; print "Hello, Jason\n"; my $input = <STDIN>;
    That should leave the screen up long enough to see what is going on. Simply hit enter and it should close. If you will provide more information on the version of Linux and what you are running for a desktop (Gnome perhaps), then some fine monk would be glad to help you.

    Chances are you just need to open up a terminal window.

    Cheers and welcome to the Monastery - L~R

      Thanks! That did it. I was coming close to giving up.
Re: Confused Newbie
by PodMaster (Abbot) on May 27, 2003 at 17:41 UTC
Re: Confused Newbie
by hardburn (Abbot) on May 27, 2003 at 17:39 UTC

    That shabang line should be #!/usr/bin/perl.

    It sounds like you're launching this from a GUI instead of a terminal. You really need to start up an xterm, make your way to the program's directory, and run it from there.

    Bask in the glory of the command line. It's one of the reasons why GNU/Linux is so much nicer to work with.

    ----
    I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
    -- Schemer

    Note: All code is untested, unless otherwise stated

Re: Confused Newbie
by sschneid (Deacon) on May 27, 2003 at 17:41 UTC
    From what I can gather from reading your post, you're trying to launch the perl script from your window manager. Is this correct?

    If so, what's most likely happening is that it's opening a terminal window, running the script, and then closing the window upon script completion. You might want to, instead, open up a terminal window yourself, and at the prompt, locate wherever you saved the file to and run perl myscript.pl (or whatever you have it named). When it's done running, it should return you back to the command prompt.

    Sorry if I'm misunderstanding your question or situation.

    -s.
Re: Confused Newbie
by dash2 (Hermit) on May 27, 2003 at 18:19 UTC
    The version of Linux you are using is almost certainly 2.4, not 9. You may be running Mandrake 9.0 or Red Hat 9.0, but the current stable Linux kernel version is 2.4. Commercial firms use different numbering schemes, mainly in order to sound more advanced than the competition.

    Just to stop you getting giggled at by other Linux people :-)

    andramoiennepemousapolutropon

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2024-04-19 15:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found