Re: from file to a list containing lists (repost w/ code)

2002-03-05 Thread James Woods
Duh, forgot to change the extention from .cgi to .txt Ok, I'm getting closer thanks to the help of all the experts out here!! I'm totally thankful for all of your help. Now, I've rewritten most of what I had before, using suggestions and examples from our resident Perl Pros. While I'm closer t

Re: from file to a list containing lists

2002-03-05 Thread James Woods
Ok, I'm getting closer thanks to the help of all the experts out here!! I'm totally thankful for all of your help. Now, I've rewritten most of what I had before, using suggestions and examples from our resident Perl Pros. While I'm closer to my desired outcome, I'm still not there; here is my

Re: from file to a list containing lists

2002-03-05 Thread Robert Aspinall
Hello, I'm not sure how you're referecing @Array, but the loop you want probably looks like foreach $line (@Array) { #your code to deal with $line goes here } In that loop, $line will equal each line of your input file, in turn. So, just call split on $line and deal with the data in sequence

Re: from file to a list containing lists

2002-03-04 Thread James Woods
OK, you're totally right, I should have printed my code 8^( I figured that it would be totally easy... then I remembered that I'm a noobie and everything is confusing 8^) First, let me say that I'm trying to get work to buy me a Perl book, but money at the state is tight these days. I've eve

Re: from file to a list containing lists

2002-03-04 Thread Jeff 'japhy' Pinyan
On Mar 4, Eric Beaudoin said: >>>@records = ( [ "f", "Axe Strike", "d" ], >>> [ "f", "Disquiet of our people", "p" ], >>> [ "f", "Dwarven Armor", "p" ] ); >> >>Well, except that the last field will have a newline in it! > > push @records, [ split /\|/, chomp($_) ] while

Re: from file to a list containing lists

2002-03-04 Thread Eric Beaudoin
At 19:17 2002.03.04, Jeff 'japhy' Pinyan wrote: >>my @records; >>open FILE, "yourfile" or die "Can't open file your; >> >>push @records, split /\|/ while(); >> >>close FILE; > >You mean > > push @records, [ split /\|/ ] while ; > >You want to construct an array reference. > >>@records = ( [ "f",

Re: from file to a list containing lists

2002-03-04 Thread Jeff 'japhy' Pinyan
On Mar 4, Eric Beaudoin said: >my @records; >open FILE, "yourfile" or die "Can't open file yourfile:$!"; > >push @records, split /\|/ while(); > >close FILE; You mean push @records, [ split /\|/ ] while ; You want to construct an array reference. >@records = ( [ "f", "Axe Strike", "d" ], >

Re: from file to a list containing lists

2002-03-04 Thread Eric Beaudoin
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