in reply to Substring comparison
foreach(@Array1) { $string1 = $_; foreach(@Array2) { my string2 = $_; my $result = index($string2, $string1); if($result <= 0) { print $string1, " is not found in ", $string2, +"\n"; } } }
Result: 16my $string = "FFF NNN JKK III LLL QQQ"; my $substr = "LLL"; my $result = index($string, $substr); if($result > 0) { print "Result: $result\n"; } else { print "not found";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Substring comparison
by trammell (Priest) on May 01, 2012 at 15:16 UTC | |
|
Re^2: Substring comparison
by JavaFan (Canon) on May 01, 2012 at 16:11 UTC |