[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ale] Simple Perl Question
- Subject: [ale] Simple Perl Question
- From: krugerb at benning.army.mil (Bob Kruger)
- Date: Mon, 25 Feb 2002 10:59:12 -0500
I haven't written anything in Perl for about a year, and am hitting a
brick wall on a simple one. Hopefully, someone in the group has a quick
answer.
I am reading lines of data from a file and doing an extract to go into a
SQL database. Fields are delimited by "|". There are 12 fields per
line. I would like to read each line into an array, and then export
four of the fields. So, and extract could be:
...
$ifile = "./52.txt";
open(INFO, $ifile);
@lines = <INFO>;
close <INFO>;
for ($x=0; $x <= $#lines; $x++) {
#don't want to use the first line;
if ($x == 0) (
} else {
@line = $lines[$x];
print $line[0] $line[4] $line[6] $line[9] \n;
}
};
......
I am stumbling on the delimiter part. Bottom line is that I have
forgotten how to designate a delimiter for input into an array, and a
host of other stuff.
Any hints?
Regards - Bob Kruger
---
This message has been sent through the ALE general discussion list.
See http://www.ale.org/mailing-lists.shtml for more info. Problems should be
sent to listmaster at ale dot org.