|
Perl ProgrammingHere are my notes on programming in Perl (the Practical Extraction and Report Language) used on many websites. Let me know what you find helpful or missing. Take the Brainbench certification test on Perl
| Topics this page: Related:
|
|
SummaryLike Python, Perl is an interpretive language which is interpreted into machine code (compiled) by the computer while the program is running.
|
Releases and Versions
Larry Wall began working on Perl while working for the U.S. National Security Agency (NSA) "Blacker" project. He released Perl as open source software to the comp.sources.misc newsgroup near the end of 1987. He released again in 1989 under the GNU public license. Download from ASPN.activestate the most prevalent distribution of Perl. There are distributions of Perl for many platforms: Windows, Linux, Solaris, etc. On Windows, choose an "ASC" or "MSI" (Windows System Installer). Sample code is available from companion websites to books on Perl:
Strawberry Perl (W) by Adam Kennedy and others |
Debugging Perl
Part of the frustration with this language is its flexibility. As the Perl creed says: "There Is More Than One Way To Do It!" Here are my strategies for creating Perl programs quickly and reliably.
| Perl Tutorial from Leeds by Stephen Knilans. is my favorite - comprehensive, yet to-the-point, with exercises! It's part of the Perl Webring. |
ToolsPerl for Windows 32-bit systems is available as part of the MKS Toolkit. The use operator loads the ":standard" cgi.pm library from Lincoln Stein, which contains a suite of methods that create forms and other HTML markup on-the-fly. The library also preserves the values entered in the form if the CGI script submits the form data back to itself.
| Perl Monks.org |
Ideas on Perl Programming
Here's a sample program, with annotations. use CGI qw/:standard/; $foo = new CGI;
$guest_record = $foo->param('guest_name')
A dot is used to concatenate two strings.
open STDERR, ">&STDOUT"
open(RUN_PARMS, "| get_it");
open(FORMATTED_REPORT_FILE, "format_it |");
while (<GUESTS>) {
print %ENV;
print "<A href=\"mailto:webmaster\@site.com\">Webmaster</A>. \n";
for ($count = 1; $count <= 10; $count += 1) { print("the counter is now $count\n"); }
print GUESTS $guest_record, "\n";
Semi-colons separate commands. In order to access an SQL database using Perl, there are two pieces required, they are
|
| Your first name: Your family name: Your location (city, country): Your Email address: |
Top of Page
Thank you! |