Hello again rohan_532,

You are mixing many questions and issues here.

Having a case sensitive string is something different that comparing with a regex with numbers. So take a step backwards and analyze it.

If you have an upper case string and you want to convert it to a lower case you can simply use lc or the opposite assume that you have a lower case string and you want to convert to upper case uc. Or even igf you manage to split the string into pieces and you want to make only the first letter of the string upper case ucfirst.

Regarding the regex part of your question:

#!usr/bin/perl use strict; use warnings; my @steps_name = ("1-2 Steps", "5-7 Steps", "8-10 Steps", "11-15 Steps +"); foreach my $element (@steps_name) { print "Matched with ".$element."\n" if ($element =~ /[0-9]-[0- +9]/); } __END__ $ perl test.pl Matched with 1-2 Steps Matched with 5-7 Steps Matched with 8-10 Steps Matched with 11-15 Steps

As you can see this will match with all elements, so you need to be a bit more specific on what you want to compare against. For example 1-2 Steps only, or multiple choices?

Again I am looking forward to update your question with more details.

Update: Have you read the answers that marinersk and AnomalousMonk have already provided you on your previous question regex for case insensitive? I looks like they have already addressed your problem.

Hope this is more clear now, programming gives you infinite possibilities, you have to tell us exactly what is the desired output.

Seeking for Perl wisdom...on the process of learning...not there...yet!

In reply to Re^3: compare individual string with complete array by thanos1983
in thread compare individual string with complete array by rohan_532

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.