Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: How do i create array of arrays

by extremely (Priest)
on Jan 13, 2001 at 08:05 UTC ( [id://51557]=note: print w/replies, xml ) Need Help??


in reply to How do i create array of arrays

my $a = [ "mark", 1, 2, "three"]; #anon array my @b = ( "anon", 3, 4, "five"); #named array my $b = [@b]; #anon array from named my $c = [ $a, [@b], $b, [ "werd", 5, 6, "seven" ] ]; my @d = ( $a, $b, $c->[3] ); print "$d[2]->[3] and $c->[3][3]\n";

Does that help? () make lists, [] make anon arrays, you can nest anon arrays easily to make nested structures.

Edited by davido to correct mismatched bracket types.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://51557]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (5)
As of 2024-04-25 14:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found