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

Re: [MacPerl] Arrays



At 6:09 PM +0100 2/4/00, 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.
>
>Julian
>

You'll want to use the standard "open the file and loop through each line"
code, and then use push to put the contents of the line, properly broken up
by split into a list of the fields, into your array.

You should use the Help menu in MacPerl to look at the help for Regular
Expressions and Builtin Functions.  And probably look at the help for
Syntax and Data Structures, if you're having difficulty with while loops or
arrays.

-Jeff Lowrey



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