ktsirig has asked for the wisdom of the Perl Monks concerning the following question:
You can notice that these 2 strings have PF01389 in common. So, I wanted to knows if there is a way of checking for values inside one string that are equal with values in the other.$a = 'PF01389 6 218 1 255 430.09'; $b = 'PF00691 PF01389';
but it doesn't work, because it searches for the whole $a or $b and not parts of them.if ($a=~/$b/ or $b=~/$a/) {print "correct";}
2006-09-21 Retitled by GrandFather, as per Monastery guidelines
Original title: 'Is there a way?'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Finding common substrings
by jdporter (Paladin) on Sep 20, 2006 at 22:19 UTC | |
|
Re: Finding common substrings
by johngg (Canon) on Sep 20, 2006 at 22:29 UTC | |
|
Re: Finding common substrings
by ayrnieu (Beadle) on Sep 20, 2006 at 22:13 UTC | |
|
Re: Finding common substrings
by mreece (Friar) on Sep 20, 2006 at 22:34 UTC | |
by ktsirig (Sexton) on Sep 20, 2006 at 22:46 UTC | |
by johngg (Canon) on Sep 21, 2006 at 09:19 UTC | |
by mreece (Friar) on Sep 21, 2006 at 16:36 UTC | |
by johngg (Canon) on Sep 21, 2006 at 20:50 UTC | |
|
Re: Finding common substrings
by Anonymous Monk on Sep 21, 2006 at 04:12 UTC | |
|
Re: Finding common substrings
by Persib (Acolyte) on Sep 21, 2006 at 10:10 UTC | |
|
Re: Finding common substrings
by bsb (Priest) on Sep 21, 2006 at 15:29 UTC | |
by planetscape (Chancellor) on Sep 22, 2006 at 01:52 UTC |