CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Pattern matching

 



yellowman
Novice

Jan 18, 2007, 6:25 AM

Post #1 of 2 (312 views)
Pattern matching Can't Post

I have a file that is read into an array. The output of the values in the array look like this:

Users of dev_ed: (Total of 24 licenses issued; Total of 8 licenses in use)
Users of Reporter: (Total of 24 licenses issued; Total of 0 licenses in use)
Users of ReporterPro: (Total of 24 licenses issued; Total of 0 licenses in use)
Users of RPGetConnectedWind: (Total of 24 licenses issued; Total of 1 license in use)

How do I strip just the third word out of the strings and add them to an array (the word between
the word 'of' and the ':')?

Thanks...


KevinR
Veteran


Jan 18, 2007, 10:08 AM

Post #2 of 2 (310 views)
Re: [yellowman] Pattern matching [In reply to] Can't Post

it would be nice if you would post code you have been trying, otherwise it seems like you just want code written for you, which is not the purpose of the forum. Al you need is a simple pattern match:


Code
/\s+(\w+):/


now the word you want is in $1 and can be put into an array. If it's always the third word, split() would also work.
-------------------------------------------------

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives