our approach
|
contact us
Perl Basics In Pictures
Basics
Variables
Numbers
Subroutines
Logic & Loops
Files
Employ looping
Print a list of elements
Create a new script with this code:
#!/usr/bin/perl
print "Content-Type: text/html \n\n";
# This script demonstrates how to print
# an array using a foreach loop.
@AcmeCars = ("Ford","Dodge","Chevy");
print "<pThe text array contains:</p>";
foreach $thisCar (@AcmeCars){
print "$thisCar<br>\n";
}
Save the script as
printlist.pl
in the
PERLSCRIPTS
folder.
<< BACK
NEXT >>