Well, the problem is that this is just one section of a file the other sections actualy have different format. When I get to this section I key on the section name to know how to process it and will need to key on the last paren know that this section is done and to try and key on what the next section is and how it is processed. Not all of the data in this section is of the form mon 1 every know and then you get something like list( "one" "two"). The data i am making up as I didn't think it was important. I figured the form is what was needed. Once I get the key value pairs it doesn't matter because I am going to read another file like this and compare the data to make sure nothing has changed between the two files. I like the regx thing tho, it gives me some ideas.. I will see if I can make it work with that...
perl knucklehead On Thu, 2003-12-11 at 11:28, drieux wrote: On Dec 11, 2003, at 9:30 AM, Eric Walker wrote: [..] > yes( "hello" "goodbye" > > ( (one 2) (two 3) (three 4) > ) > (( mon 1) (tues 2) (wed 3) > ) > ((jan 1) (feb 2) (march 3) > ) > ) [..] The question of course is whether that 'ordering' is important, or can you just use a hash? IF you do not really need to know about the paren count then don't count it. IF you know that your generalized date is going to be of the form (<word> <num>) then your word_num regEx would look like my $word_num = qr/\( # our opening paren (\w+)\s+(\d+) \)/ix; # our closing paren I use the 'x' option to lay it out pretty like that. then the rest is a walker while ( <INFO1> ) { chomp; next if (/^\s*$/); # no need empty lines s/^\s+//; # kill leaing lines my $line = $_; # now we have a line to play with while ( $line =~ /$word_num(.*)/) { $hash{$1} = $2; # our $word_num pattern fetched these $line = $3; # for everything else there is (.*) } } while (my ($k, $v) = each %hash) { print "$k -> $v\n"; } ciao drieux --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>