There is still a little confusion about what you mean and I think you are getting some terms mixed up. It is not clear from your post that the "original array" is indeed an array. It could be if declared like

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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.