in reply to Re^2: count the maximum no.of occurence
in thread count the maximum no.of occurence
Sorry, you need to add newlines, like so:
use warnings; use strict; my $str1 = q/It is a guide to action which ensures that the military a +lways obey the commands of the party./; my $str2 = q/It is a guide to action that ensures that the military wi +ll forever heed Party commands is a guide./; my $n = 0; while ( $str1 =~ /(?=(\S+\s+\S+\s+\S+))/g ) { my $t1 = $1; while ( $str2 =~ /($t1)/g ) { print "$1\n"; $n++; } } print "No of matching is : $n\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: count the maximum no.of occurence
by sarvan (Sexton) on Jun 30, 2011 at 07:17 UTC | |
by Anonymous Monk on Jun 30, 2011 at 07:34 UTC | |
by sarvan (Sexton) on Jun 30, 2011 at 10:52 UTC | |
by sarvan (Sexton) on Jun 30, 2011 at 09:24 UTC | |
by Anonymous Monk on Jun 30, 2011 at 09:55 UTC | |
by roboticus (Chancellor) on Jun 30, 2011 at 10:22 UTC | |
by sarvan (Sexton) on Jun 30, 2011 at 07:44 UTC | |
by Anonymous Monk on Jun 30, 2011 at 08:10 UTC |