At 19:03 2002.03.04, James Woods wrote:
>I've got a file that I would like to import into a list.  The file has many rows, and 
>each row has 3 records, seperated with a "|".
>
>Example of file is as below:
>
>f|Axe Strike|d
>f|Disquiet of our people|p
>f|Dwarven Armor|p
>
>When I was just using 1 record in the file, @Array = <FILE> ended up working great.
>
>Now that I've moved on and added two more records, I just don't know what to do.  I'm 
>working with split now, but it's only returning the first row.
>
>I know you all can help this rookie out, thanks!!!


Would have be nice to see a bit of your code...

here is something that might be doing what you want:

my @records;
open FILE, "yourfile" or die "Can't open file yourfile:$!";

push @records, split /\|/ while(<FILE>);

close FILE;

Now @records will hold an array of arrays that will look like this:

@records = ( [ "f", "Axe Strike", "d" ],
             [ "f", "Disquiet of our people", "p" ],
             [ "f", "Dwarven Armor", "p" ] );

Hope this is want you meant.


----------------------------------------------------------
Éric Beaudoin               <mailto:[EMAIL PROTECTED]>


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

Reply via email to