The SCRIPT BELOW works, when listing and comparing each array.
#list $array_lenth = @array = ("perl.a", "perl.b", "perl.c"); $array_lenth = $array_lenth -1; for ($i = 0; $i <=$array_lenth; $i++) { $element = $array[$i]; print "--value of $i element = $element \n"; #values to match @TheArray = qw(perl.a perl.b perl.c); if (grep {$_ eq $element} @TheArray) { print qq(<td>Found '$element' element!</td>\n); $element =[$_]; } else { print "NOT FOUND '$element' element!\n" ; $element =[$_]; }; }
HOWEVER, if the @array and @TheArray were substituted with the values of
$dummy_a = $input{'dummy_a'};
which is now
$dummy_a = "perl.a perl.b perl.c perl.d perl.e";
THEN, set as
@array = $dummy_a; or @TheArray = $dummy_a;
THE list in $dummy_a is recognized as a value from one element only...Therefore I cannot count and compare the list. Why is that. c_lhee@yahoo.com

In reply to Comparing and Counting Arrays Length by c_lhee

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.