LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] [OT] perl help

[ILUG] [OT] perl help

Paul Jakma paulj at itg.ie
Wed Sep 13 16:34:29 IST 2000


as per kevin l.'s suggestion i've decided to try my hand at perl
(and cause this list could do with a spate of perl newbie questions)..

so i'm trying to capture parts of the results of a /regex/ into
variables, eg something along the lines of:

basically i'm trying to figure out how to do something like the
following:

while (<MSGS> ) {
        if (/^([A-Za-z]{3}) ([0-9]{2}) ([0-9{2}).*$regex[$i]/) {
                $month[$i] = \1;
                $date[$i] = \2;
                $hour[$i] = \3       
}

how do it? how can i catch what \1, \2 and \3 match and store them in
variables?

thanks,

--paulj





More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell