Array Variables in Perl

Advertisements

  Top Tutorials     New Tutorials     Submit     Login     Register  

Tutorial Detail

Array Variables in Perl

This tutorial walks through using array variables in Perl.
http://blog.codebeach.com/2008/03/array-variables-in-perl.html
  • Total Hits: 16069

  • Average Rating :
    URL RatingURL RatingURL RatingURL RatingURL Rating

  •  

  • Total Votes: 144 votes

  • Category: Perl & CGI/Getting Started

  • Submitted on: 2008-03-16 01:01:33

  • Submitted By: Devesh Khanna

  • Set as Favorite

Description:

You’ve already seen simple arrays. We used them for the “command line” variables. Simple arrays begin with the “@” symbol. If you want a specific value from the array, you index that value using its number in the array. If you want the first item from the array, you ask for “$ARGV[0]”. If you want the third item, use “$ARGV[2]”.

Arrays always use the “@” symbol. Scalar variables always use the “$” symbol. A piece of an array is always a scalar. (You can’t have arrays inside of arrays in simple Perl.) That's why you use “@” to refer to the entire array, and “$” to refer to items within the array. If you want to know how many values are in an array, use the scalar variable $#ARRAY. This is actually the index of the last element, so for the count, you’ll need to add one.    More detail...

Rating Detail

 Stars  Percentage  Total Vote
 One star  Vote LeftVote MiddleVote Right 38.19%  55
 Two starsTwo star  Vote LeftVote MiddleVote Right 10.42%  15
 Three starsThree starsThree stars  Vote LeftVote MiddleVote Right 11.81%  17
 Four starsFour starsFour starsFour stars  Vote LeftVote MiddleVote Right 11.11%  16
 Five starsFive starsFive starsFive starsFive stars  Vote LeftVote MiddleVote Right 28.47%  41

Caste Your Vote

 Rating  Selection  Guidelines
 Poor:     Very disappointing, useless.
 Fair:     Below average, disappointing but not useless.
 Good:     About average in its class.
 Very Good:     Above average for its category.
 Excellent:     One of the best Tutorials in its category.





Advertisements
Advertisements