Hi Ronald, I'm very gratefull for your reply. I'll try to clarify myself a little: Ronald J Kimball wrote: > > On Sat, May 13, 2000 at 11:21:15AM +0200, Jimmy Lantz wrote: > > Complexed perl problem. > > > > Hi, I have the following problem: > > I need to do the following operation on a (huge) data file see sample > > below : > > Strip the first row of the < & > and print it into a output file > > then I have to read the the rest of the data and to be able to > > and put it into a hash ??(if that's the best way to go) and associate > > the <PRON(pers,sing)> with the value I and <V(montr,pres)> with think > > and so forth so that I can analyse the values depending on if it's PRON > > or V or something else. > > Which should be the keys and which should be the values? How are you > analyzing the values? ############################################### The key should be: <PRON(pers,sing)> And the value should be the word standing in front of the key: I key= <V(montr,pres)> value= think I <PRON(pers,sing)> think <V(montr,pres)> I need to anlyze the contents of the keys to see if they are of a certain gramatical category ie. <ART(def)> the article is def then I need to print the def to the outputfile. Then again I need to be able to analyze if there's a adjective determing a noun the I need the verb. the below is the output that I require. Hope that helps. This is the output that I need: S1A-001 #2:1:B||indef/def||main||things||I think the **[main]** things that I saw as as **[absent]** from disa from work with with disabled people was || That is: The first row stripped from <&> and the text ICEGB:||the value of the key ART, if none write NONE || the value of ADJ, if several print new rows, one row for each ADJ ||if theres a Noun connected to the ADJ print it else print NONE ||the whole sentence without the keys.|| ############################################## > > The following: > > **[main <ADJ(ge)>]** > > is a match and need's to be stripped of the > > **[ & ]** and printed to the output file. > > > > Everything printed (I need to print more on each row but that I can > > handle myself) has to be delimited by > > || (double pipe) > > > > Further below is a perlprog that I started to make until I realized that > > I needed some help. > > > > <ICE-GB:S2A-016 #2:1:B> > > I <PRON(pers,sing)> think <V(montr,pres)> the <ART(def)> **[main > > <ADJ(ge)>]** things <N(com,plu)> that <PRON(rel)> I <PRON(pers,sing)> > > saw <V(cxtr,past)> as <PREP(ge)> <,> <PAUSE(short)> as <PREP(ge)> > > **[absent <ADJ(ge)>]** from <PREP(ge)> disa <UNTAG> from <PREP(ge)> work > > <N(com,sing)> with <PREP(ge)> with <PREP(ge)> disabled <ADJ(edp)> people > > <N(com,plu)> was <V(cop,past)> > > How long will each of these blocks between <ICE-GB... be? It will probably > be easier to work on a whole block at once, rather than line by line. ############################## they will be rather the same size gve or take a few numbers... ################################## > > > <ICE-GB:S3A-051 #8:1:A> > > **[medium <ADJ(ge)>]** speed <N(com,sing)> > > > > NB! Data filerows above can vary in length (see row 2 & 4) > > > > #!/usr/bin/perl > > $faktor1 = "<ICE-GB:"; > > $icedata = "icedata.data"; > > > > open(FILE, "$icedata"); > > Don't forget to check the return values of system calls! > > open(FILE, $icedata) or die "Can't open $icedata: $!\n"; > > > while(<FILE>) { > > $file = $_; > > chomp $file; > > if ($file =~ /$faktor1/) { > > $file =~ s/$faktor1/ /; > > That part is redundant; you don't need to match twice. > > if ($file =~ s/$faktor/ /) { > > > $file =~ s/>/ /; > > print "$file\n"; > > } > > elsif ($file !~ /$faktor1/ ){ > > That's redundant too; either /$faktor/ matches or it doesn't. > > } else { > > > @db_fields = split (/>/, $file); > > foreach $field (@db_fields) { print "$field\n"; } > > } > > else{ > > print "No match\n"; > > This block will never be entered. > > > } > > } > > close(FILE); > > I have some ideas on ways to do this, but I'd like to know the details > I asked about before I write any code. > > Ronald ###################################### I hope this answers your questions. Thank you very much for your help ! Your sincerely Jimmy Lantz Sweden ==== Want to unsubscribe from this list? ==== Send mail with body "unsubscribe" to macperl-webcgi-request@macperl.org