Don't ask to ask, just ask | |
PerlMonks |
(Ovid) Re: regexp'sby Ovid (Cardinal) |
on Oct 03, 2000 at 06:20 UTC ( [id://35039]=note: print w/replies, xml ) | Need Help?? |
Assuming that the data is in a file called "data.txt", I might try something like the following (untested):
The regex breaks out as follows: For more information about why I did not use a simpler regex like /^(\d+).*\b(\w+)$/, you may want to read Death to Dot Star!. Simpler, however, would be to use a split (also untested):
Cheers, Update: I would just like to say that I have no frickin' idea why I wrote that regex. Yes, it works. So what? I saw regex in the title and got carried away. Use the split; UpdateII: Yup. I have the key value backwards. It's fixed now. Sigh. Join the Perlmonks Setiathome Group or just go the the link and check out our stats.
In Section
Seekers of Perl Wisdom
|
|