Skip to content
Hello, Perl
step 1/5

Reading — step 1 of 5

Learn

~1 min readBasics

Perl was created in 1987 by Larry Wall as a tool for making reports. It exploded in the 90s as the lingua franca of CGI scripts and system administration. Today it's still everywhere on Unix systems — apt, git hooks, log parsers, mail filters.

use strict;
use warnings;

print "Hello, Perl!\n";

Always use strict and warnings. Without them Perl silently accepts undeclared variables and other footguns. With them you get errors and warnings that catch real bugs.

  • use strict — requires variables to be declared with my, our, or local
  • use warnings — turns on diagnostic warnings (uninitialized values, etc.)

print does NOT add a newline — you must include \n. say does add one (requires use feature 'say'; or use 5.010;).

Comments use #. Statements end in ;.

Discussion

Ask a question, share an insight, or help someone who’s stuck.

Sign in to post a comment or reply.

Loading…