Perl Examples

Below are example programs written in Perl. They are documented so you can see how they work. All the files are viewable through your browser. In order to use it, just save is to your machine as a pl file and change the path to your interpreter's path. A short description of the perl example is to the left of the filename.

array.pl The array program gives an example of how to setup a perl array. Tested under HP-UX and NT.
array-splicing.pl The array-splicing program will demonstrate how to do array splicing. Tested under HP-UX and NT.
do-while-loop.pl The do-while loop will loop through numbers performing the test at the end. It will continue until the expression is false. Tested under HP-UX and NT.
for-loop.pl The for loop will loop through a series of numbers until the condition is met. Tested under HP-UX and NT.
foreach.pl The foreach loop will run through an array automatically increasing the subscript, it will then retrieve the value and print it out. Tested under HP-UX and NT.
hash.pl The hash program will show how to setup and use a hash. Tested under HP-UX and NT.
hello.pl The hello world program is the first program that is normally written. So this will be the first example. Tested under HP-UX and NT.
if-then-else.pl The if-then-else conditional statement will print out a line if a condition is met. Tested under HP-UX and NT.
pass-by-reference.pl The pass-by-reference program will show how to pass values by reference. Tested under HP-UX and NT.
pass-by-value.pl The pass-by-value program will show how to pass by value. Tested under HP-UX and NT.
quotes.pl The quotes program will demonstrate the use of single and double quotes. Tested under HP-UX and NT.
string-concatenate.pl The string-concatenate program will give an example of string concatenation. Tested under HP-UX and NT.
string-repition.pl The string-repition program will give an example of how to do string repition. Tested under HP-UX and NT.
subroutine.pl The subroutine program will give an example of how to setup a subroutine and call it. Tested under HP-UX and NT.
until-loop.pl The until loop will print out a series of numbers until the expression becomes true. The expression is teseted at the end. Tested under HP-UX and NT.
while-loop.pl The while-loop will print out a series of nubmers while an expression is true. The test is done at the beginning. The Tested under HP-UX and NT.


<---
Return To Perl Page
1