Cyber Sentry
Application Development
System Architecture Design
Technical Due Diligence
Qmail Support and Consultancy
Scripting Help
Partners
Client Testimonials
Help Sections
Software Patents
Site Map
Contact us
Community
Home

Array variables

Once we have looked at the scalar variable we need to get a bit more complicated. A more interesting kind of variable is the array variable which is a list of scalars (ie numbers and strings). Array variables have the same name convention as scalar variables except that they are prefixed by an @ symbol. The following statement assigns two array variables, @trees and @colour:

 

@trees = ("ash", "oak", "pine");

@colour = ("red", "blue");

 

You can access the data in an array by using indices starting from 0, and square brackets are used to specify the index. The expression

 

$trees[2]

 

would return oak. Notice that the @ has changed to a $ because eels is a scalar.



Qmail Help Section
Perl Tutorial
Linux Command Line Help
Top top Copyright Cyber Sentry Ltd  

Cyber Sentry -- Application Development Sitemap 1 2 3