Array variable that refers to a simple variable array, which costs around other children in France it will be a number starting from 0, 1, 2, ... to becoming the variables in the Perl language A simple array. This model is used as follows.
The announced value variables Array (announced in the variable value to array Standard. Using the @symbol) such as.
@number_practice = (1, 2, 3, 4, 5);
@string_practice = ( "default", "with", "language", "Perl");
To access this Array variables are used as models.
print $number_practice[3]; # program will display 4.
print $string_practice[3]; # program to display Perl.
Changes in values in the children Array Alliance needed. Use the form below.
$number_practice[3] = 10; # therefore variable. @number_practice = (1, 2, 3, 10, 5).
$string_practice[3] = "C"; # therefore variable. @string_practice = ( "start," with "," language "," C ").
To determine the number of members of the Array using the following form.
print $#number_practice; # 5 displayed.
The need to reduce the number of members of the Array using the following form.
$#number_practice = 3; # means that the lower member of the array to the remaining 3.
To view all the values of variables a simple Array.
print @number_practice; # Display 1 2 3 10 5.
print @string_practice; # display default language to C.
Array in Perl.
วันจันทร์ที่ 14 กันยายน พ.ศ. 2552
สมัครสมาชิก:
ส่งความคิดเห็น (Atom)
0 ความคิดเห็น:
แสดงความคิดเห็น