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
|
|---|