:)
Robert Aspinall
V-ONE Corporation
[EMAIL PROTECTED]
- Original Message -
From: James Woods [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, March 04, 2002 7:03 PM
Subject: from file to a list containing lists
I've got a file that I would like to import into a list. The file
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
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
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
On Mar 4, Eric Beaudoin said:
my @records;
open FILE, yourfile or die Can't open file yourfile:$!;
push @records, split /\|/ while(FILE);
close FILE;
You mean
push @records, [ split /\|/ ] while FILE;
You want to construct an array reference.
@records = ( [ f, Axe Strike, d ],
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 FILE;
Sorry. ;) chomp()
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