Lance Prais wrote at Sat, 01 Jun 2002 01:17:55 +0200: > I would like to read the following to see if on line is repeating more then once. > > I would start this? > > I was trying something similar : > > my $line=$_; > my @results = $line =~ m/(sleeping for 10)/gi; > print 'Found ', scalar (@results), " occurences\n"; > > But it does not seem to be working
I tried this and got the right result. my $line=<<SLEEPING; Sleeping for 20 second Sleeping for 10 second Sleeping for 50 second Sleeping for 40 second Sleeping for 30 second Sleeping for 20 second Sleeping for 10 second SLEEPING my @results = $line =~ m/(sleeping for 10)/gi; print 'Found ', scalar (@results), " occurences\n"; Could it be that in $line is only one line like the name suggests. For your expression you have to match with all lines in one variable. Best Wishes, Janek -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]