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

i am trying to make a perl program run from the terminal of ubuntu, and for some reason when >perl name.pl is ran, nothing happens and it just returns the $> prompt. I have no idea why this is happening, is there something else i need to install, or a command to link the perl command to running the script in the terminal? thanks

Replies are listed 'Best First'.
Re: perl ?compiler?
by Fletch (Bishop) on Nov 19, 2008 at 18:44 UTC

    The problem is on line 17. Reroute the neutrino flow through the jefferies tubes on deck 36 and it should clear right up.

    (See How (Not) To Ask A Question. There's no way anyone's going to be able to give you more than a vague set of pointers which might by some remote chance match up with that extremely vague problem description. Maybe name.pl doesn't produce any output on alternate weekdays. Maybe it does, but evil capuchin monkeys have hijacked your ubuntu install's libc and replaced it with twigs and berries. No one here has any idea what some random name.pl does ether.)

    (I mean there's the obvious stab in the dark, that you're suffering from buffering; but again that's a vague stab.)

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.

Re: perl ?compiler?
by eighty-one (Curate) on Nov 19, 2008 at 19:01 UTC

    What program? Is it something you wrote or something you got somewhere else?

    It's possible that everything is working fine, if you're running a program that does not produce output. I can't imagine why a program would produce no output if it was meant to be run from the command line, but it's possible. And if you're new to Perl and writing a simple program, you might just have forgotten to write anything, or perhaps are accidentally writing a blank variable. For example, this would produce no output without telling me I'd done something wrong due to my failure to use strict and use warnings:

    #!/usr/bin/perl my $Nothing = "Hello World\n"; print $nothing;

    Maybe try a simple test, like running

    perl -e 'print "Hello!\n";'
    from a command line, to confirm that Perl is OK and you can see output to your terminal.

Re: perl ?compiler?
by Your Mother (Archbishop) on Nov 19, 2008 at 18:40 UTC

    Sounds like it is being run but doing nothing. You should check the usual suspects.

    >which perl >more name.pl # etc.

    Plus, put use strict; use warnings; at the top of your Perl script. And maybe a print "done\n" at the bottom. Whatever is up might become clear.

Re: perl ?compiler?
by CountZero (Bishop) on Nov 19, 2008 at 21:42 UTC
    But it ran perfectly OK. I know because everytime I got a nice transfer of a considerable sum of money to my bankaccount ;-)

    No, seriously, how do you expect anyone to know what name.pl is supposed to do? Perhaps this program does not output anything to the screen.

    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

Re: perl ?compiler?
by JavaFan (Canon) on Nov 19, 2008 at 18:58 UTC
    "nothing happens"? How do you know? What makes you think your shell doesn't tell your OS to start perl and that perl doesn't execute name.pl, none of them complaining the other doesn't do its work?

    I place my bet on that you just misinterpret things. Just because a program doesn't display anything on STDOUT doesn't mean nothing happened.

Re: perl ?compiler?
by Anonymous Monk on Nov 19, 2008 at 18:43 UTC
    Try running the debbugger
    perl -d -e 1