Posts in the “perl” category

Perl pipe - Reading from a pipeline with Perl

Perl pipeline FAQ: How can I read output from a shell command pipeline (pipe) in a Perl script?

One of the great things about Perl is that it's very easy to run operating system commands, and read the output of those commands. Perl makes this process very easy and natural - it's just like reading data from a file. In this article we'll demonstrate the process of running external commands from within Perl, and then reading the output of those commands.

Perl CGI.pm example - a password field form

Here's the source code for a Perl CGI password field example. The Perl code below shows how you can display an HTML form with a password field, using the Perl CGI.pm module. The first time this script is called it displays a password field in a form. After you submit the form, this script displays the text that you entered in the password field.

Here's the source code for this Perl CGI.pm password field example script:

Perl CGI.pm - a popup menu example

Here's the source code for a Perl CGI popup menu example. (It's called a "popup menu" in the CGI.pm module, but it renders an HTML SELECT/OPTION form in a browser.)

The Perl code below shows how you can display an HTML form with a popup menu, using the Perl CGI.pm module. The first time this script is called it displays the popup menu (combo box) in a form. After you submit the form, this script displays the item you selected from the combo box.

Here's the source code for this Perl CGI.pm combo box example script:

Perl redirect - a Perl CGI redirect example

Perl CGI redirect FAQ: Can you share some Perl CGI redirect example code?

Here's the source code for a simple Perl CGI redirect example. An HTML redirect is pretty easy to program manually, but the Perl CGI.pm module makes it even easier to redirect a user from one page to another.

Perl redirect CGI script example

Here's the source code for this Perl CGI redirect example script:

Regular expression examples (common regex patterns)

Regular expression FAQ: Do you have a list of common regular expression examples, i.e., the most common regex patterns used in programming languages like Java, Perl, PHP, Ruby, and others?

I've been asked several times, so I thought it might be helpful to post some of the most common regular expression examples that are used in programming. Honestly I haven't tested any of these yet -- I did them off the top of my head -- but I think they will work for most open source programming languages.