music |
| | OSdata.com |
Perl
summary
This subchapter looks at perl, a UNIX (and Linux) command, including both running shell scripts from a web browser and running Perl from the shell.
perl is used to run a CLI version of Perl.
perl
This subchapter looks at perl, a UNIX (and Linux) command, including both running shell scripts from a web browser and running Perl from the shell.
perl is used to run a CLI version of Perl.
getting started
Check that Perl is actually running on your system by typing perl -v from the command line. Your exact results may vary.
$ perl -v
This is perl 5, version 12, subversion 4 (v5.12.4) built for darwin-thread-multi-2level
(with 2 registered patches, see perl -V for more detail)
Copyright 1987-2010, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.
$
Use which to determine the location of your local copy of Perl:
$ which perl
This is perl 5, version 12, subversion 4 (v5.12.4) built for darwin-thread-multi-2level
/usr/bin/perl
$
This example assumes that you have created the scripts directory in your home directory.
Create a Perl script called script.pl and save it in the new scripts directory (folder):
#!/usr/bin/perl
print "Hello World!";
Notice that we skip the chmod step typical for activating shell scripts.
Run your new script by running the perl program with your script as the file to execute:
$ perl ~/scripts/script.pl
Hello World!
$
brief history
Perl created by Larry Wall in 1986. Perl was originally intended as a utility to create reports. Perl stands for Practical Extraction and reporting Language.
comments, suggestions, corrections, criticisms
free music player coding example
Coding example: I am making heavily documented and explained open source code for a method to play music for free almost any song, no subscription fees, no download costs, no advertisements, all completely legal. This is done by building a front-end to YouTube (which checks the copyright permissions for you).
View music player in action: www.musicinpublic.com/.
Create your own copy from the original source code/ (presented for learning programming).
Because I no longer have the computer and software to make PDFs, the book is available as an HTML file, which you can convert into a PDF.
Names and logos of various OSs are trademarks of their respective owners.