From:                   "Michael Kramer" <[EMAIL PROTECTED]>
> I need to make an array with multiple levels example:
> I'm new to perl and have been programming in VBscript for about 2
> years now so the code here is in vb because i know that better.
> 
> dim my_array(1,3)

        my @my_array;

> my_array(0,0) = "fred"

$my_array[0][0] = "fred";

> my_array(0,1) = "John"
> my_array(0,2) = "mike"
> my_array(0,3) = "dork"
> 
> my_array(1,0) = "mary"
> my_array(1,1) = "sally"
> my_array(1,2) = "stacy"
> my_array(1,3) = "bigger dork"
> 
> response.write my_array(0,3)  'aka. "dork"

print $my_array[0][3];

> It's like an array inside an array.  I figured our arrays but hashes
> are still a little weird.  This might be a perfect problem fixed by
> hashes. Thanks to anyone who understands and tells me how to do this.

Another option would be

        my %my_array;
        $my_array{0,0} = "fred";
        print $my_array{0,3};

In this case the data structure is actually a hash where the key is
        $x . $; . $y
that is the first index, a strange character and the second index.

The second is better for big, sparse arrays (arrays that are mostly 
empty).

HTH, Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
        -- Terry Pratchett in Sourcery


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to