------------------------------------------------ On Fri, 20 Dec 2002 16:31:55 +0000, Al Lukaszewski <[EMAIL PROTECTED]> wrote:
> Greetings, > > I'm writing a script that is intended to read in a comma-delimited > file called "qa.db" line-by-line. Each line is split into fields and > the first two fields are evaluated. The first field is a line > reference; the second is a lemma. If the line reference is the same > as the previous entry, the lemma should be appended to the *beginning* > of the output line ("qa.txt"). If the line reference is different, > two blank lines and the new line reference should be appended to the > output file. > > Among the problems I am encountering, one is a conceptual one: how do > I get Perl to write the lemmas right to left (i.e., unshift) but not > append to the very beginning of the file. > > I also am getting some error messages. When I run the code pasted > below, I get the following: > > > *[OUTPUT]* > > syntax error at ./chgr.pl line 34, near "$line(" > syntax error at ./chgr.pl line 46, near ") # If the evaluation scalar and control >scalar are not equal, do the following: > {" > Global symbol "@newQA" requires explicit package name at ./chgr.pl line 47. > Global symbol "@newQA" requires explicit package name at ./chgr.pl line 47. > syntax error at ./chgr.pl line 50, near "}" > Execution of ./chgr.pl aborted due to compilation errors. > > > Any help would be appreciated very much. > > Yours, > > Al Lukaszewski > > > *[PROGRAM]* > > #!/usr/bin/perl > # > # Read in the data file > # > > use strict; > use warnings; > > my $file; > $file = '4Q246.db' ; # Name the file > open(INFO, "$file" ) ; # Open the file > my @db; > @db = <INFO> ; # Read it into an array > close(INFO) ; # Close the file > > # Initialize scalars > my $line; # = scalar by which program steps through data > my $fieldRef; # = holding scalar for line reference field > my $fieldForm; # = holding scalar for the lemma field > my $fieldMorph; # = holding scalar for the parsing field > my $fieldSynt; # = holding scalar for the syntax field > my $fieldLex; # = holding scalar for the lexical information field > > my $newQA = ""; # = holding scalar for the output, the contents of >this scalar will be the compiled texts and will be written to the output file > > my @field; > > my $fieldEval; > my $fieldCtrl = "null" # Preset control variable to 'zero' Your syntax error is in the above line, missing semi-colon. I didn't understand fully your other question, so defer to the list or request more info... http://danconia.org <snip> -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]