Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Print hello world not working

by kcott (Archbishop)
on Jul 15, 2020 at 07:24 UTC ( [id://11119346]=note: print w/replies, xml ) Need Help??


in reply to Print hello world not working

G'day ferbio,

Welcome to the Monastery.

The most likely cause is your shebang line: '#!/usr/bin/perl'. On one computer, perl is installed in /usr/bin/; on another computer, it's installed elsewhere.

You need to tell us which OSes you're using and show all output. It seems odd that you get no output at all: perhaps no "Hello, World...", but were there any other messages. Here's what I get when I try to run perl from both an existing and non-existing location:

$ /usr/bin/perl -e 'print "Hello, world!\n"' Hello, world! $ /usr/not_bin/perl -e 'print "Hello, world!\n"' -bash: /usr/not_bin/perl: No such file or directory

Putting your posted code — but using an invalid path to perl in the shebang line — into a script and running:

$ cat crap.pl #!/usr/not_bin/perl use strict; use warnings; print "Hello, World...\n"; $ ./crap.pl -bash: ./crap.pl: /usr/not_bin/perl: bad interpreter: No such file or +directory

Take a look at perlintro for a gentle introduction of this concept; perlrun has a more detailed discussion.

[Note: Please put all code, data and program output within <code>...</code> tags. Doing so will mean that HTML rendering (e.g. converting a sequence of whitespace characters into a single space) will not affect what you post. It also allows us to access a verbatim copy. See "How do I post a question effectively?" and "Writeup Formatting Tips".]

— Ken

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (7)
As of 2024-04-23 13:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found