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

Matching text

Thread Previous | Thread Next
February 1, 2002 00:30
Matching text
Message ID:

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.



Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About