in reply to Re^5: A Beginner Needs Homework help
in thread A Beginner Needs Homework help
lol.
I realized what you meant and changed the program so it would die if not read. what I'm trying to work on now is the pattern matching. Upon reading my textbook I don't really think I need substitution. What I need my program to do is to recognize similar words with their numbers and add them together, otherwise look over the word (and associate number) but print them anyway.
($info=~ /(\w+ (-?\d+ )+)/)
That should match any word with its number, since \w is for word charters and \d is for numbers. + is for one or more of the same to match.. the and ? is so that the last number can still be counted. the dash in front of it is undefined to me by my text book.. (elements of programming with perl)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: A Beginner Needs Homework help
by Anonymous Monk on Apr 11, 2014 at 21:37 UTC |