I've recently been working on a string problem in perl and I can't get my hear around one specific part>
Let's say we have a string $str = "tltltltltltltlttl"; There is a specific region on the string, which interests us, let's say from 10th char to 15th char. we run the string through a program, which gives us a 2d conformation of this string example> $str2 =
<pre>
tl t
tltltl tl
t
tl
tltltlt tltl
l tl
</pre>
I am perfectly aware how one is supposed to find the wanted region in the $str (just use substr $str, 10, 6
. Let's say we save this region as $region. The question is. How do I find that exact region in the $str2, with the locations of chars same as in the first string, example>
<pre>
$str =tltltl; $region = substr $str,2,5
$str2 =
tl
t (this is the first char I want located in $str2)
l (this is the second char I want located in $str2)
t
l
</pre>
I cannot seem to somehow map the regions from the first one to some code that would explicitly tell me where are related regions in $str2. SO basically I need to somehow maintain the index through the transformation to $str2 process. Thanks.