---
name: "JavaScript::PerlArray"
section: "3pm"
platform: "linux"
package: "libjavascript-perl"
version: "1.16-3"
release: "Debian 6.0 (Squeeze)"
platforms: ["linux"]
url: "https://new.carta.tech/JavaScript::PerlArray"
---

# JavaScript::PerlArray(3pm)

Encapsulate a Perl array in JavaScript space

## NAME

JavaScript::PerlArray - Encapsulate a Perl array in JavaScript space

## INTERFACE

### CLASS METHODS

- new ()

  Creates a new instance with an empty array.

### INSTANCE METHODS

- get\_ref ( )

  Returns a reference to the underlying array.

### JAVASCRIPT INTERFACE

This class is exposed in JavaScript space as **PerlArray** and can be instanciated using `"new PerlArray();"`.

*Methods*

- push (arg, ...)

  Pushes the arguments onto the array

- unshift (arg, ...)

  Unshifts (ie inserts in the beginning) the arguments into the array.

- pop ( )

  Returns the top element.

- shift ( )

  Returns the bottom element.

*Properties*

Instances of this class can be accessed as a normal array using integer indicies like `"arr[2]"` both for  reading and setting. If a negative index is used it is relative to the tail.

- length

  The number of items in the array.
