my @originalArray = qw{D F Y I N G W};
or it could be a space separated string like
my $originalString = q{D F Y I N G W};
Your "output array" is not an array, it is a scalar containing a string. If your original array is an array you need to turn it into a string so you can search it. Do something like
my $stringToSearch = join q{}, @originalArray;
However, if it already was a string with spaces in it, you need to remove those with a global replace
(my $stringToSearch = $originalString) =~ s{\s+}{}g;
Once you have a contiguous string of letters you can do another global replace looking for "SEKAR" and using parentheses () which are regular expression memory. For example, if you do $string =~ m{(SEKAR)}; then if the match succeeds the string "SEKAR" will be placed in the special read-only variable $1 for later use. So you could now do
$stringToSearch =~ s{(SEKAR)}{<sometag>$1</sometag>}g;
That will replace every occurrence of SEKAR in the string with <sometag>SEKAR</sometag>.
I hope this will give you enough pointers to get started.
Cheers,
JohnGG
In reply to Re: color a letter in an array
by johngg
in thread color a letter in an array
by Tony1
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |