Vector or ArrayList in Perl?

B

Bob X

Does Perl have the equivalent of a Vector or ArrayList? I am learning them
in Java currently and was just wondering if there was a Perl equivalent.
 
T

Tassilo v. Parseval

Also sprach Bob X:
Does Perl have the equivalent of a Vector or ArrayList? I am learning them
in Java currently and was just wondering if there was a Perl equivalent.

Perl doesn't need an object of its own for such trivial things. A simple
array is all you need for it. See 'perldoc perlfunc' ("Functions for
real @ARRAYs") to see which functions are available for arrays.

Tassilo
 
S

Steve Grazzini

Bob X said:
Does Perl have the equivalent of a Vector or ArrayList? I
am learning them in Java currently and was just wondering
if there was a Perl equivalent.

Not an equivalent (thank god) but plain @arrays are at least
as flexible as Java's array-like collection classes. Have a
look at the "Functions for real @ARRAYs" and "Functions for
list data" in perlfunc, and the standard List::Util module.

If you want array-like collections as Objects, check CPAN
(or have a look at Ruby).
 
E

Eric J. Roode

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Does Perl have the equivalent of a Vector or ArrayList? I am learning
them in Java currently and was just wondering if there was a Perl
equivalent.

Thank goodness, no. Perl's simple arrays are more capable than Java's
Vectors and ArrayLists. Only languages with poor type flexibility (such as
Java or C++) need such classes.

- --
Eric
$_ = reverse sort $ /. r , qw p ekca lre uJ reh
ts p , map $ _. $ " , qw e p h tona e and print

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBP4ne8GPeouIeTNHoEQLa5gCg4QSQTILQ0M8Pgsnjj0hAjd7S4r8AoJKX
RM50MReSE+OmvhX/pZ4fKD0N
=1Yq+
-----END PGP SIGNATURE-----
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,142
Messages
2,570,818
Members
47,362
Latest member
eitamoro

Latest Threads

Top