Hello World program written in three languages (nano editor used):
**Perl (hello.pl):**
### Perl (hello.pl)
```
#!/usr/bin/env perl
@ -50,7 +50,7 @@ print "Hello World!\n";
```
**Python (hello.py):**
### Python 3 (hello.py)
```
#!/usr/bin/env python3
@ -61,17 +61,17 @@ print("Hello World!");
```
**NOTE!** Pay attention when referring to python executable. On some Linux distributions, python refers to python2, and on some, python refers to python3. Practices differ. It can be safer to use 'python3' or 'python2' instead of just 'python'.
**NOTE!** Pay attention when referring to python executable. On some Linux distributions, python still refers to `python2`, and on some, python refers to `python3`. Practices differ. It can be safer to use 'python3' or 'python2' instead of just 'python' if not sure.
In a simple program like "Hello world" this python issue doesn't really matter but if any python libraries are imported into the code, you must know which python environment to use, Python 2 or Python 3.
In a simple program like "Hello world" this python issue doesn't really matter. However, if any python libraries are imported into the code, you must know which python environment to use, Python 2 or Python 3.
**C (hello.c):**
### C (hello.c)
```
// Include Standard Input Output Library (stdio.h core library included in)
// Include Standard Input Output Library
#include<stdio.h>
// Declare main function for the program. Int for returning a integer
// Declare main function for the program. int type for returning a integer
int main()
{
// Print Hello World! (stdout in CLI)
@ -82,19 +82,27 @@ int main()
}
```
hello.c requires compiling from source code to executable binary file. Therefore, we compile the source code with the following command in _hello-world_ folder:
`hello.c` requires compiling from source code to executable binary file. Therefore, we compile the source code with the following command in `hello-world` folder:
```
gcc -o hello hello.c
```
after which our 'binary' can be executed with
after which our `hello` binary can be executed with
```
~/hello-world/hello
```
All programs give stdout/output string "Hello World!" in our shell environment:
**NOTE:** You can check file details by issuing the following command:
```
file ~/hello-world/hello
hello: ELF 64-bit LSB pie executable x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=8e76492bc5ce6c65df8ec5ce7be42645fae2ab70, not stripped
```
All programs give output string "Hello World!" (stdout data stream) in our shell environment:
```
[newuser@goauldhost: hello-world ]$ pwd
@ -116,6 +124,8 @@ This could have been very interesting assignment to work out. Unfortunately, my