Originally posted by Carneige Roder: nothing so far. Idon't know where to begin. any ideas?
It looks pretty straightforward, the perl code doesn't seem to be doing anything fancy. (and for perl, that is hard to do -- it is a really feature rich language)
The first two lines open files, one for reading, one for writing. The while, if, elsif (else if), and eq (string comparison) maps to a java counterpart. The print just maps to a print outputstream counterpart. You may need to wrap it in a print output stream.
The funny statement in the while, is read a line and make sure it is not null.
The first line in the while loop is the one problem. It basically say send $line to a regular expression and put the values in $1, $2, etc., which are assigned to variables in the next few lines. Unfortunately, you need to understand regular expressions to do this.
Anyway, I just converted the perl code to a design outline. You get to write the Java code...
Henry [ December 04, 2004: Message edited by: Henry Wong ]
I think we need some background on where you are having trouble. Have you ever programmed in Java? Have you ever programmed in Perl? Have you ever programmed at all? Henry's answer assumed you knew Java but were unfamiliar with Perl. If that's not the case, please give us a clue what your background is. Thanks.