[ale] Simple Perl Question
Tommie M. Jones
tj at atlantageek.com
Mon Feb 25 11:05:53 EST 2002
On this line:
@line = $lines[$x];
change to:
@line = split('|', $lines[$x]);
---------------------------
'Business Intelligence' is not an Oxymoron - http://www.intelliforge.com
On Mon, 25 Feb 2002, Bob Kruger wrote:
> 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.
>
>
---
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