小骆驼 第三章 列表与数组

数组

#!/usr/bin/envperl

use strict;
use warnings;


my @arr; $arr[2] ="apple" ;print "$arr[3.14-1]\n"; 

#$arr[5_234_567_890] = "abc";print "$arr[1_234_567_890]\n";

##apple
##

my $end = $#arr;my $length = $end +1;print "$length\n";

##3

my $last_one = $arr[ $#arr ];print "$last_one\n";

my $test_last_one = $arr[-1];print "$last_one = $arr[-1]\n";

my $test_other = $arr[-1000000];print "$test_other";
##3
##apple = apple
##Use of uninitialized value $test_other in string at test.pl line 22.
原文地址:https://www.cnblogs.com/yuanjingnan/p/11061486.html