Question for you GURU's -- Strings and if construct!!!-thanxs

Posted on 2000-05-02
Last Modified: 2010-03-05
OK I have another quest:
                      now what if when i run this command thru my script
                      and what gets stored in my variable $label are the following below


                      all gotten from doing this
                      foreach $label (@RCs[$n])

                      { $label = `idlcall $NROID get_all '"Rcl" 100'; }
                      now i want to do a check.
                      I want to see if the match a certain criteria and i want to see i wach label has the following attahed to it: igb.appls.slrc-object

                      and if it does do something and if it does not report error to the user,,,
                      how do i go abt writing the if construct..

                      pls i need help ASAP... thanks...
Question by:CODER
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
LVL 16

Accepted Solution

maneshr earned 50 total points
ID: 2769856

what i am doing is looking in the $label variable and if i get a label that ends with igb.appls.slrc-object i say all is OK.

if not i print Error.

Here is the code snippet. Add this after $label = `idlcall $NROID get_all '"Rcl" 100';

if ($label=~ /^(.*)igb\.appls\.slrc-object$/){
  print "OK!!\n";
  print "Error\n";

Author Comment

ID: 2769958
#retrieving the label and OID for each Remote Control Entry
foreach $label_and_OID (@RCs[$n])  
   $label= `idlcall $NROID get_all '"Rcl" 100'`;

now can i stick your above code in my foreach loop or outside the loop

thanks....  i am thinking outside but i DONT WANT TO LOOSE ANY VALUES in the $Label.
what do u think? thanks...
LVL 16

Expert Comment

ID: 2770081
there you go. now that should work.

the if statement that i have provided, uses $label in a READ-ONLY context. Therefore you will NOT loose anything from $label.

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

LVL 16

Expert Comment

ID: 2778921
did you try the code??

did it work for you??

let me know. :-)

Author Comment

ID: 2780948
yes it worked thanks...
LVL 16

Expert Comment

ID: 2781001
were you looking for specific solution??

wasnt the solution i provided up to your expectations??

let me know.

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

626 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question