perl的列表(List)和数组(Array)

If a scalar is the "singular" in Perl, as we described it at the beginning of Chapter 2, the "pulural" in Perl is represented by lists and arrays.

A list is an ordered collection of scalars. An array is a variable that contains a list. People tend to use the terms interchangeably, but there‘s a big difference. The list is the data and the array is the variable that stores the data. You can have a list value that isn‘t in an array, but every array avriable holds a list (althonght  that may be empty).

Since lists and arrays share many of the same operations, just like scalar values and variables, we‘ll treat them parallel. Don‘t forget their difference thongh.

时间: 2024-07-31 02:38:19

perl的列表(List)和数组(Array)的相关文章

JS中数组Array的用法示例介绍 (转)

new Array() new Array(len) new Array([item0,[item1,[item2,...]]] 使用数组对象的方法: var objArray=new Array(); objArray.concact([item1[,item2[,....]]]-------------------将参数列表连接到objArray的后面形成一个新的数组并返回,原有数组不受影响.如:var arr=["a","b","c"];

学习Swift -- 数组(Array) - 持续更新

集合类型--数组 Array是Swift中的一种集合类型:数组,数组是使用有序列表储存同一类型的多个值,与OC的NSArray的最大不同是,Swift的数组是值类型,OC的数组是引用类型 声明数组的方法 // 如果声明可变数组 就设置为变量 var someMutableArray = [Int]() // 声明了空数组 类型为Int // 相反声明不可变数组就设置为常量 let someArray = Array(count: 5, repeatedValue: 0.03) // 声明了一个不

C#中数组Array、ArrayList、泛型List<T>的比较

在C#中数组Array,ArrayList,泛型List都能够存储一组对象,但是在开发中根本不知道用哪个性能最高,下面我们慢慢分析分析. 一.数组Array 数组是一个存储相同类型元素的固定大小的顺序集合.数组是用来存储数据的集合,通常认为数组是一个同一类型变量的集合. Array 类是 C# 中所有数组的基类,它是在 System 命名空间中定义. 数组在内存中是连续存储的,所以它的索引速度非常快,而且赋值与修改元素也非常简单. Array数组具体用法: using System; names

数组 array 矩阵 list 数据框 dataframe

转自 :  http://blog.csdn.net/u011253874/article/details/43115447 <span style="font-size:14px;">#R语言备忘录三# #数组array和矩阵matrix.列表list.数据框dataframe #数组 #数组的重要属性就是dim,维数 #得到4*5的矩阵 z <- 1:12 dim(z) <- c(3,4) z #构建数组 x <- array(1:20, dim = 

perl快速获得数字在数组中的排序

某些情况下,有一个已经排好序的数组,如果要获得一个数字在这个数组中的顺序,用遍历的方法会比较慢,如下是一个快速获取位置的函数,会返回:在这个数组中,有多少个值比给定的值要小. #! /usr/bin/env perl use strict; use warnings; my @array=(1,2,2,3,4,5,6,7,8,9,10); my $value=shift; @array=sort{$a<=>$b} @array; my $percent=&findLess($value

Thinkphp数组array常用函数

这篇文章主要介绍了php常用数组array函数,结合实例形式总结分析了php常用的数组操作函数,包括数组的赋值.拆分.合并.计算.添加.删除.查询.判断.排序等,需要的朋友可以参考下 array_combine 功能:用一个数组的值作为新数组的键名,另一个数组的值作为新数组的值 <?php$a = array("one","two","three");$b = array("一","二","

js — 数组Array

目录 1. isArray 2. 转换方法 3. 分割字符串 join 4. 栈方法 5. 队列方法 6. 重排序方法 7. 操作方法 8. 位置方法 - 索引 9. 迭代方法 数组 array 解释器 遇到var声明的变量,会把var声明的变量提升到全局作用域下 1. isArray isArray() 判断当前数组是否为数组,返回值是true,则证明是数组 var arr = ['red','green','yellow']; console.log(Array.isArray(arr));

oracle 数组 array

一维数组示例如下: -- Created on 2014-5-15 by ADMINISTRATOR DECLARE TYPE Arr1 IS VARRAY(10) OF NUMBER; Tab_1 Arr1; TYPE Arr2 IS TABLE OF NUMBER INDEX BY BINARY_INTEGER; Tab_2 Arr2; BEGIN -- Test statements here Tab_1 := Arr1(1, 3, 4, 6, 3, 2, 8, 5); FOR a IN

C++中的数组array和vector,lambda表达式,C字符串加操作,C++中新类型数组(数组缓存),多元数组,new缓冲

 使用C++风格的数组,不需要管理内存. array要注意不要溢出,因为它是栈上开辟内存. array适用于任何类型 #include<iostream> #include<array> #include<vector>   //C++的标准库 #include<string>   //C++字符串 #include <stdlib.h> using  std::array; //静态数组,栈上 using std::vector; //动态

Scala 数组-Array

环境: CentOS 6.3 1. 定义且同时初始化数组 $ cat array.scala val numNames2 = Array.apply("France","US","china") println(numNames2(0)) [[email protected] scala]$ scala array.scala France Array.apply("France","US","c