New to perl not programming as such Anyways this is what I have written

#!/sbin/perl -w use strict; use InCharge::session; # Input credentials for the connection to DOMAIN my $domain = 'IP'; my $user = 'admin'; my $passwd = "asdfgh"; my $broker= 'localhost:426'; my $session = ""; # Setting up the connection to console/domain manager.... $session = eval {InCharge::session->new( broker => $broker, domain => $domain, username => $user, password => $passwd) }; if($@){ print "Could not Connect to $domain \n......."; exit 2; } my $sourceDomainName=eval{$session->getServerName}; if($@){ print "Script Failed to get ServerName....Exiting the Script\n +"; exit 1; } print "Server is....... $sourceDomainName \n"; # Reading the Key Value from ini Files my @providerCloudSequence; open(my $iniFH, '<', '/tmp/user_defined_connection.ini') or die "Unabl +e to open file:$!\n"; while(<$iniFH>) { chomp; my @providerCloudClass=split('=',$_); push @providerCloudSequence,$providerCloudClass[0]; if($@){ print "Script Failed to get the Sequence....Exiting the Script +\n"; exit 1; } } my %idlcodes = map { split /=|\s+/; } <$iniFH>; if($@){ print "Script Failed to create the hash....Exiting the Script\ +n"; exit 1; } close $iniFH; <b> I get the file into hash and sequence (keys) into array as hash do +esnt follow sequence , idea is to use keys from array and get value f +rom hash and compare againt the instances i get below. Incharge sessi +on is a 3rd part API </b> my @networkAdapterInstances=$session->getInstances("NetworkAdapter"); for (my $index=0;$index<=$#networkAdapterInstances;$index++){ my $interfaceObject=$session->object("NetworkAdapter",$network +AdapterInstances[$index]); ( my $interfaceAlias,my $systemName,my $deviceID)=$interfaceOb +ject->get("InterfaceAlias","SystemName","DeviceID"); if($@){ print "Script Failed \n"; exit 1; } exit 1; print "$interfaceAlias \n"; }

In reply to Re^6: Create a expression to cmpare a formal against a string by Anonymous Monk
in thread Create a expression to cmpare a formal against a string by learnP

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.