Hello World in PerlPublished on 29 May 2019 (Updated: 29 May 2019)
In this article, we’ll tackle Hello World in Perl.
How to Implement the Solution
Without further ado, let’s dive straight into our implementation of Hello World in Perl:
print "Hello, World!";
Well, that was anticlimactic. In fact, it was about as disappointing as our implementations of Hello World in Python and Ruby. That said, who doesn’t love a simple implementation (talking to you, Java).
At any rate, let’s dig into this a little bit. For starters, we’ll notice there are no parentheses required for Perl’s print function. I use the word “required” because we can actually call print with them:
However, from my understanding, it’s good Perl style to omit the parentheses for built-in functions.
Oh, I should probably clarify something. In Perl, they’re not called functions. Instead, they’re called subroutines, and you can declare one of your own using the sub keyword. That’s a new one for me1!
How to Run the Solution
As usual, we can try the solution using an online Perl interpreter. All we have to do is drop the code into the editor and hit run.
As an alternative, we can always run Perl locally. First, we’ll need to get the latest version of Perl from the official website. After that, we should probably get a copy of the solution. Assuming Perl is now in our path, we can get to work:
Since Perl is a scripting language, we can quickly run the script with the command above. If successful, “Hello, World!” should print to the console1.
J. Grifski, “Hello World in Perl,” The Renegade Coder, 08-April-2018. [Online]. Available: https://therenegadecoder.com/code/hello-world-in-perl/. [Accessed: 29-May-2019]. ↩ ↩2