Array and List Functions


StatementFunction

delete($a, "string")

Deletes string from the associative array $a.

each(%arrayname)

Returns successive key value pairs from the associative array %arrayname.

grep ($string, filename)

Searches the file filename for occurrences of $string and returns the array of elements from filename for which $string returned true.

join($gluestring, @a)

Forms a single string from the values in the array list @a, using the string in $gluestring as a separator between each element.

keys(%a)

Returns a list of all the current keys in the associative array %a.

pop(@array)

Pops and returns the last value of @array.

push(@array, $a)

Pushes the values of $a onto the end of @array.

reverse(@a)

Reverses the order of elements in an array list.

scalar(exp)

Forces an expression to be evaluated in a scalar context.

sort(@a)

Sorts the elements in an array list as if they were single strings in ascending ASCII order.

splice(@array, $x {,$y {,list} } )

Removes the elements designated by offset $x and length $y from @array, replaces them with list if any, and returns the removed elements. Removes the elements from the offset $x onward if length $y is omitted.

split(/exp/, $a)

Searches for all occurrences of exp in the string $a and returns all parts of the string that don't match in a list of values.

shift(@array, $a)

Adds elements to the left side of an array list.

unshift(@array, $a)

Removes elements from the left-hand side of an array list.

values(%a)

Returns a list of the current values of %a.