Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Thanks for looking!#!/usr/bin/perl use strict; use warnings; open (FILE, 'my_file.txt'); while (<FILE>) { chomp; my ($a, $b, $c, $d, $e, $f, $g, $h) = (split)[0,1,2,3,4,5,6,7,8]; # it + doesn't work here cause of the spaces in the names it # print data to get it ready to be inserted into db print "$a - $b - $c - $d - $e - $f - $g - $h\n"; } close (FILE); exit; <code><br> Test file: <code> 2009122233388675647 9988230 2009-01-01 JOE DOE + JR JOEDOEJRWX@EMAIL.COM + COMPANY JOES C. LTD., CORP. 1900-01-01 00:00:00.000 1900-01-0 +1 00:00:00.000 20091222333886756 99882308K 2010-01-01 JOE DOE + JOEDOEJRWX@TEST.COM + COMP INS / CORP. LTDA 1900-01-01 00:00:00.000 1900-01-0 +1 00:00:00.000
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Parsing text file Help!
by roboticus (Chancellor) on Nov 22, 2010 at 16:31 UTC | |
|
Re: Parsing text file Help!
by kennethk (Abbot) on Nov 22, 2010 at 16:37 UTC | |
by Anonymous Monk on Nov 22, 2010 at 16:59 UTC | |
|
Re: Parsing text file Help!
by fisher (Priest) on Nov 22, 2010 at 16:28 UTC | |
|
Re: Parsing text file Help!
by Khen1950fx (Canon) on Nov 22, 2010 at 18:35 UTC | |
|
Re: Parsing text file Help!
by raybies (Chaplain) on Nov 22, 2010 at 16:43 UTC | |
by kennethk (Abbot) on Nov 22, 2010 at 16:47 UTC | |
|
Re: Parsing text file Help!
by locked_user sundialsvc4 (Abbot) on Nov 22, 2010 at 19:15 UTC | |
by Anonymous Monk on Nov 22, 2010 at 19:41 UTC | |
by TomDLux (Vicar) on Nov 23, 2010 at 03:44 UTC | |
by Anonymous Monk on Dec 24, 2010 at 21:43 UTC |