develooper Front page | perl.beginners | Postings from February 2002

Matching text

Thread Previous | Thread Next
From:
Kevin
Date:
February 1, 2002 00:30
Subject:
Matching text
Message ID:
200202010616.g116Glx20089@mailman.arcom.com.au
Hi 

I have a really simple problem that I could solve easily with a strstr() call 
in c but cannot get my head around in perl.

I have have the following input.

Active Accounted actions on tty57, User fred Priv 1
 Task ID 35176, Network Accounting record, 02:04:00 Elapsed

what I want to do is 

   for $data (@raw_data){
	if $data contains "User"
		$username = [the word after User];
   }

The length of this string can vary so I cannot rely on "User" being at n 
charcters from beginning or end of string.

I am sure it is a RegEx problem but any help/pointers appreciated.

Thanks

Kevin

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About