[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Arrays



On Fri, Feb 04, 2000 at 06:09:26PM +0100, Julian Phillips wrote:
> I wish to input a text file with 300 records, each containing 6 fields, into
> a multi dimensional array so that I can refer to each item using subscripts
> such as field(1,3) referring to record 1, third field.
> 
> 
> How can I read in this file and load such an array. None of the manuals seem
> to make this clear.
> 

An example:

while (<>) {
    push @records, [split /:/, $_];   # push an anonymous array
                                      # (adjust field separator as necessary)
}

$field = $records[0][2];              # row 0, col 2


Refer to the documentation on Lists of Lists, References, and Data
Structures (perllol, perlref, perldsc).


Ronald

# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org