[ale] Simple Perl Question
Bob Kruger
krugerb at benning.army.mil
Mon Feb 25 10:59:12 EST 2002
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.
More information about the Ale
mailing list