Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: regular expressions. help

by NovMonk (Chaplain)
on Jun 29, 2004 at 19:27 UTC ( #370591=note: print w/replies, xml ) Need Help??


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.

Pax,

NovMonk

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).

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://370591]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2022-05-22 00:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (78 votes). Check out past polls.

    Notices?