in reply to regular expressions. help

Let me see if I understand what you want-- if the line begins with "HISTOGRAM OF" you want to print the words "in loop"? Why would you need anything more than this for the match:

 if (/^HISTOGRAM OF/){...etc}?

As to what you're doing with it, you could get at the gpa value by splitting the data on the white space and/or the asterisk. I'm not sure what you're after, but you could make an array of the gpa values that way and use them.

That's how I'd start anyway. Hope this is helpful. Good luck.



Replies are listed 'Best First'.
Re^2: regular expressions. help
by apocalyptica (Acolyte) on Jun 29, 2004 at 19:36 UTC
    Well, what I'm doing is taking the value of the data in the fourth field (in this example, it is gpa, but it could be a whole host of random letters strung together) and putting it into a variable. But, that isn't the problem I'm having right now -- the problem is getting the blasted thing to match and acknowledge that there is anything there.

      When trying to construct an re to match something, perl -de 0 can be very helpful. Set $_ to your sample data and then you can iteratively construct your re with x /blah/ (seeing if it matches and what matches at each step).