Re: Parsing pipe delimited file

2003-10-25 Thread Wiggins d'Anconia
David Storrs wrote: On Wed, Oct 22, 2003 at 07:22:24PM +0200, Kevin Pfeiffer wrote: In article <[EMAIL PROTECTED]>, Charles K. Clarkson wrote: Kevin Pfeiffer <[EMAIL PROTECTED]> wrote: : Where I am stuck is on the question: : : Given an @array such as : ("Title of Song", "Artist", "Title", "Ano

Re: Parsing pipe delimited file

2003-10-25 Thread David Storrs
On Wed, Oct 22, 2003 at 07:22:24PM +0200, Kevin Pfeiffer wrote: > In article <[EMAIL PROTECTED]>, Charles K. Clarkson > wrote: > > > Kevin Pfeiffer <[EMAIL PROTECTED]> wrote: > > > > : Where I am stuck is on the question: > > : > > : Given an @array such as > > : ("Title of Song", "Artist", "Tit

RE: Parsing pipe delimited file

2003-10-22 Thread Charles K. Clarkson
Kevin Pfeiffer <[EMAIL PROTECTED]> wrote: : What I came up with (by trying instead of just asking): ;-) : : # removes leading and trailing quote marks : s/^"|"$//g foreach @pairs; It might be more efficient to use two statements like the faq does with leading and trailing space. foreach (

RE: Parsing pipe delimited file

2003-10-22 Thread Kevin Pfeiffer
In article <[EMAIL PROTECTED]>, Kevin Pfeiffer wrote: > In article <[EMAIL PROTECTED]>, Charles K. Clarkson > wrote: > >> Kevin Pfeiffer <[EMAIL PROTECTED]> wrote: >> >> : Where I am stuck is on the question: >> : >> : Given an @array such as >> : ("Title of Song", "Artist", "Title", "Another A

RE: Parsing pipe delimited file

2003-10-22 Thread Kevin Pfeiffer
In article <[EMAIL PROTECTED]>, Charles K. Clarkson wrote: > Kevin Pfeiffer <[EMAIL PROTECTED]> wrote: > > : Where I am stuck is on the question: > : > : Given an @array such as > : ("Title of Song", "Artist", "Title", "Another Artist", "etc"), > : is there an easy way to strip out the quotation

RE: Parsing pipe delimited file

2003-10-22 Thread Charles K. Clarkson
Kevin Pfeiffer <[EMAIL PROTECTED]> wrote: : Where I am stuck is on the question: : : Given an @array such as : ("Title of Song", "Artist", "Title", "Another Artist", "etc"), : is there an easy way to strip out the quotation marks. s/"//g foreach @array; HTH, Charles K. Clarkson -- Head

Re: Parsing pipe delimited file

2003-10-22 Thread Kevin Pfeiffer
Hi all, Here is what I have so far for this... use strict; # cannot remember syntax for "use warnings but no 'uninitialized' my ($album, @upc_list); my @data_src = parse_data(); print "Data Source: "; print "$_ " foreach @data_src; print "\n"; # test my $album1 = $album->{$upc_list[0]}; fore

Re: Parsing pipe delimited file

2003-10-21 Thread R. Joseph Newton
Kevin Old wrote: > Hello everyone, > > Thanks to everyone who helped with my last problem last week. I've hit > a snag in another problem this week. > > I need to parse the following data: > > "COUNTRY MUSIC HALL OF FAME UPC#: 0-84296-22922-2"||"COUNTRY FEMALE > PARTY SONGS VOL. 2 UPC#: 0-8

Re: Parsing pipe delimited file

2003-10-21 Thread Kevin Pfeiffer
In article <[EMAIL PROTECTED]>, Kevin Pfeiffer wrote: [...] > The thing to add (I'd have to check the Perl Cookbook for the terminology) > is a "reverse lookup"(?) so that in addition to: > > $album{$upc} > > you could also access your data via: > > $album{$album_name} > > (I think -- trying to

Re: Parsing pipe delimited file

2003-10-21 Thread Kevin Pfeiffer
In article <[EMAIL PROTECTED]>, Kevin Old wrote: [...] > Then the rest of the lines are "Tracks" and "Artists". What I need to > do is get the appropriate tracks and artists in respective (@tracks, > @artists) arrays inside the hash. > > Basically, I need to know how to write code that does this

Re: Parsing pipe delimited file

2003-10-21 Thread Kevin Old
On Tue, 2003-10-21 at 16:49, Kevin Pfeiffer wrote: > In article <[EMAIL PROTECTED]>, Kevin Old wrote: > [...] > > I need to parse the following data: > > > > "COUNTRY MUSIC HALL OF FAME UPC#: 0-84296-22922-2"||"COUNTRY FEMALE > > PARTY SONGS VOL. 2 UPC#: 0-84296-28682-9"||"COUNTRY MALE P

Re: Parsing pipe delimited file

2003-10-21 Thread Katy Brownfield
Exactly what structure you want to end up with isn't clear, but I assume you that you need to keep the tracks and artists associated with their UPCs. If there were only one upc and one track/artist per line, grouped by upc, it would be easier. The position of the track/artist on each line is wh

Re: Parsing pipe delimited file

2003-10-21 Thread Kevin Pfeiffer
In article <[EMAIL PROTECTED]>, Kevin Old wrote: [...] > I need to parse the following data: > > "COUNTRY MUSIC HALL OF FAME UPC#: 0-84296-22922-2"||"COUNTRY FEMALE > PARTY SONGS VOL. 2 UPC#: 0-84296-28682-9"||"COUNTRY MALE PARTY > SONGS VOL. 2 UPC#: 0-84296-28652-2"||| ||

Re: Parsing pipe delimited file

2003-10-21 Thread Kevin Pfeiffer
In article <[EMAIL PROTECTED]>, Rob Dixon wrote: > Kevin Old wrote: >> >> Thanks to everyone who helped with my last problem last week. I've hit >> a snag in another problem this week. >> >> I need to parse the following data: > > [snip] > > > > I'd like to help Kevin, but please post your da

Re: Parsing pipe delimited file

2003-10-21 Thread Kevin Old
On Tue, 2003-10-21 at 13:54, Rob Dixon wrote: > Kevin Old wrote: > > > > Thanks to everyone who helped with my last problem last week. I've hit > > a snag in another problem this week. > > > > I need to parse the following data: > > [snip] > > > > I'd like to help Kevin, but please post your d

Re: Parsing pipe delimited file

2003-10-21 Thread Rob Dixon
Kevin Old wrote: > > Thanks to everyone who helped with my last problem last week. I've hit > a snag in another problem this week. > > I need to parse the following data: [snip] I'd like to help Kevin, but please post your data as an attachment or (even better) as an Internet link. Line wrappi

Parsing pipe delimited file

2003-10-21 Thread Kevin Old
Hello everyone, Thanks to everyone who helped with my last problem last week. I've hit a snag in another problem this week. I need to parse the following data: "COUNTRY MUSIC HALL OF FAME UPC#: 0-84296-22922-2"||"COUNTRY FEMALE PARTY SONGS VOL. 2 UPC#: 0-84296-28682-9"||"COUNTRY MALE

Re: Pipe Delimited File

2003-07-30 Thread Rob Dixon
Sorry - some spelling mistakes there: "Rob Dixon" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Pablo Fischer wrote: > > Thanks!!! > > > > That's what I was looking for! > > > > Yep, the file has a single record, It works, thanks! > > > > Now looking your code, the difference its

Re: Pipe Delimited File

2003-07-30 Thread Rob Dixon
Pablo Fischer wrote: > Thanks!!! > > That's what I was looking for! > > Yep, the file has a single record, It works, thanks! > > Now looking your code, the difference its the local $/. What does local $/ its > doing? The scalar $/ is a perdefined variable which is the 'input record separator'. It

Re: Pipe Delimited File

2003-07-29 Thread Pablo Fischer
Thanks!!! That's what I was looking for! Yep, the file has a single record, It works, thanks! Now looking your code, the difference its the local $/. What does local $/ its doing? Thanks! > > open ARCHIVO, 'MOVER.CPO' or die "Cannot open MOVER.CPO: $!"; > local $/; > my $file = ; > clo

Re: Pipe Delimited File

2003-07-29 Thread Rob Dixon
Pablo Fischer wrote: > Checking My code and trying with this: > > open(ARCHIVO, "MOVER.CPO"); > my $file = ; #Yes I know that I need to use and array, just trying > #Cerramos el archivo > close(ARCHIVO); > #open ARCHIVO, 'MOVER.CPO' or die "Cannot open MOVER.CPO: $!"; > my ($num, $fulanos, $tiempo,

Re: Pipe Delimited File

2003-07-29 Thread Pablo Fischer
Checking My code and trying with this: open(ARCHIVO, "MOVER.CPO"); my $file = ; #Yes I know that I need to use and array, just trying #Cerramos el archivo close(ARCHIVO); #open ARCHIVO, 'MOVER.CPO' or die "Cannot open MOVER.CPO: $!"; my ($num, $fulanos, $tiempo, $subject, @bodyhtml, @bodytxt, $att

Re: Pipe Delimited File

2003-07-29 Thread Pablo Fischer
Hi again; Maybe I explained a little (??) bad my problem, Using the code of John with what I need to get: open ARCHIVO, 'MOVER.CPO' or die "Cannot open MOVER.CPO: $!"; my ( $num, $fulanos, $tiempo, $subject, $bodyhtml, $bodytxt, $attach, $fechaenvio ); while ( ) { ( $num, $fulanos, $tiem

Re: Pipe Delimited File

2003-07-29 Thread John W. Krahn
Pablo Fischer wrote: > > Hi again Hello, > Ok, I have a file that each part of this is separated by pipes (|), so I load By "each part" I think you mean each line? > the file in an array and then split it, the file has 8 parts: > > Part 1: a Number > Part 2: a Big String (Maybe Im gonna use a

Re: Pipe Delimited File

2003-07-29 Thread Pablo Fischer
I forgot what does print NEEDS to print.. > But When I print it doest print what it NEEDS to print, and example of the > first pipes of F737.JOP: > > 1|Env7371.txt(6)|1|1 > > And it prints: > > 136 | | | | | And I Should be print "$num | @fulanos | $tiempo | $subject | $attach | $fechaenvio\

Pipe Delimited File

2003-07-29 Thread Pablo Fischer
Hi again Ok, I have a file that each part of this is separated by pipes (|), so I load the file in an array and then split it, the file has 8 parts: Part 1: a Number Part 2: a Big String (Maybe Im gonna use an array in this part) Part 3: a Number Part 4: a String Part 5: a BIG text (the same as