About us Privacy Disclaimer Contact us
FAQ Help Advertising Feedback
Home Sitemap Search Donate us

  Home > Computer & I'net > Data Lists...

   Browse by title articles:
   What is hot:

Data Lists

Environments

Chomp/Chop

Comparison Operators

Logical Operators

Hashes

Newsgroup Security Tips
Building Link Popularity
Selecting and Evaluating Keyphrases for Search Engine Marketing
Connecting Linux to the Internet
Prev articles12 3 456Next articles



Data Lists


Computer & I'net articlesData Lists

by David Stanley    



The best way to describe a list in Perl/CGI is a group of data. It is a sequence of values inclosed in parentheses.
(1,2,3,4,5)

Lists are not limited to numbers. Strings may also be included ...
(1,2,"hello",7,9,"world",42)

Scalar variables may also be used ...
(1,$name,5,34)
Whatever value $name holds will be placed in its spot when the list is being used.

A string continaing a scalar variable may also be used ...
(1,2,"Hello $name",78)

A list may be defined as an "empty list" ...
()

Lists may also hold expressions ...
(2+3,"hello",$value1*$value2,21)

Shortcuts may be used in lists by using two periods.
(1..10) Represents (1,2,3,4,5,6,7,8,9,10)
(1,5,7..10) Represents (1,5,7,8,9,10)
(2.5 .. 5.5) Represents (2.5,3.5,4.5,5.5)
(-2.5 .. 1.9) Represents (-2.5,-1.5,-0.5,1.5) Notice only the starting decimal factor is used.
(a..e) Represents (a,b,c,d,e)
(a..e,1..5) Represents (a,b,c,d,e,1,2,3,4,5)

Lists may be used as arrays.
@numbers = (1..10);




-----------------

Article by David Stanley. Visit his site http://www.htmlite.com. Reprinted with permission.






Articles

Auto & Trucks

Business

Computer & I'net

  ·General

  ·Apache

  ·CSS

  ·Database

  ·Hardware

  ·HTML

  ·Javascript&DHTML

  ·Linux

  ·MySQL

  ·Operating System

Perl / CGI

  ·PHP

  ·Programming

  ·Publishing

  ·Search Engines

  ·Software Problems

  ·SSI

  ·Tips & Tricks

  ·Utilities

  ·Web Design

Family

Food & Drink

Gardening

Health

Other

Pets

Psychology

Spiritual

Travel

Women

 Calculators

Budget




  Disclaimer | Privacy | Terms of useCopyright © 2004 Nice2know.com