A Simple Perl Program
This section introduces a very simple Perl program example to get you started using Perl. Although trivial for experienced Perl hackers, a short example is necessary for new users who want to learn more about Perl.
To introduce you to the absolute basics of Perl programming, Listing 41.1 illustrates a simple Perl program that prints a short message.
#!/usr/bin/perlprint 'Look at all the camels!\n';
Type that in and save it to a file called trivial.pl
. Then make the file executable using the chmod
command (see the following sidebar) and run it at the command prompt.
Get Ubuntu Unleashed 2015 Edition: Covering 14.10 and 15.04, Tenth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.