|
发表于 2004-5-2 08:31:32
|
显示全部楼层
实践一下就明白了,可能跟版本有关:
This is perl, v5.8.0 built for i386-linux-thread-multi redhat9。0
- @array = [1, 2, 3]这样的赋值是把@array看成二维数组;
- 例如:
- [linuxer@mydesktop bmp]$ perl -e '@array = ([1, 2,
- 3],,);printf("$array[0][1]\n");'
- 2
- [linuxer@mydesktop bmp]$ perl -e '@array = [1, 2, 3];printf("$array[0]\n");'
- ARRAY(0x804c88c)
- [linuxer@mydesktop bmp]$ perl -e '@array = [1, 2,
- 3];printf("@{$array[0]}\n");'
- 1 2 3
- [linuxer@mydesktop bmp]$ perl -e '@array = [1, 2,
- 3];printf("@{@array[0]}\n");'
- 1 2 3
- [linuxer@mydesktop bmp]$ perl -e '@array = [1, 2,
- 3];printf("$array[0][0]\n");'
- 1
复制代码 |
|