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

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...
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

maneshrConnect With a Mentor Commented:

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";
CODERAuthor Commented:
#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...
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.

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

did you try the code??

did it work for you??

let me know. :-)
CODERAuthor Commented:
yes it worked thanks...
were you looking for specific solution??

wasnt the solution i provided up to your expectations??

let me know.
All Courses

From novice to tech pro — start learning today.