I have the following bit of code: #!/usr/bin/perl -w open In2,"/home/rfell/tutoring/beaven/webproject/tmp/maxima_log" or die "Cannot open maxima_log:$!"; my $Line; while (defined($Line=<In2>)){ if($Line=~/(\(D\d+\))\s*(\w*)/){ print "==> $2\n"; }; }; #close In2;
maxima_log is the following GCL (GNU Common Lisp) Version(2.4.0) Wed May 9 12:02:00 CDT 2001 Licensed under GNU Library General Public License Contains Enhancements by W. Schelter Maxima 5.6 Wed May 9 12:01:49 CDT 2001 (with enhancements by W. Schelter). Licensed under the GNU Public License (see file COPYING) (C1) 2335 (D1) - ---- 24 (C2) (D2) 0 (C3) (D3) /home/rfell/tutoring/beaven/webproject/tmp/maxima_results (C4) I want to match the D lines, so my match pattern is as above. It seems that I have the following construct: (D followed by a digit(s)) followed by white space followed by some characters. I want to capture the last characters. In the above example, for line (D2), I want to get the "0", which is stored, I hope, in $2. However, I get no match. If I replace $2 with $1, I do get the (D1), etc to print. Another question 1) If I change the match pattern to /(\(D\d+\))\s+(\w*)/, that is, one or more occurences of white space, I get no match at all. $1 does not print out now. Do I not really have white space? Has anyone any idea what I am doing wrong? Thanks for your help to a perl newcomer. Dick Fell -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]