Hi,
Thanks a lot for all your help.
I am a new comer to this area.
I tried to write a program without any module.
In future i would like to edit the file according the brand.
I tried to write a code as follow...
$inputfiletoread = "/config/apollo_logins.cfg"; &Read_Config_File($inputfiletoread); sub Read_Config_File { my($inputfiletoread, ) = @_; chomp($inputfiletoread); if ( -e "$inputfiletoread") { open ( ReadFile , $inputfiletoread); flock( ReadFile, LOCK_EX); @readlines = <ReadFile>; foreach $readentirefile(@readlines) { #If Line Begins Pound Symbol(#) Skip To The Next Line; next if $readentirefile =~ s/^#//; #Check For Line Beginning And Ends With Square Brackets; if ($readentirefile =~ m/^\[/) { if ($readentirefile =~ m/\]+$/) { #Storing the string within [ ] in to string storegroupname; $storegroupname = $readentirefile; $storegroupname =~ s/^\[//; $storegroupname =~ s/\]+$//; } } #If Line is Blank Skip To Next Line; next if $readentirefile =~ s/^$//; #Splitting The Lines INTO Fields using Delimiter; next if $readentirefile =~ m/^\[/; my($optionname, $optionvalue) = split(/=/, $readentirefile); #print "HERE Key=$optionname Val=$optionvalue\n"; } flock (ReadFile, LOCK_UN); close ReadFile; } else { #Error: To Be Written To Log Manager #print " The Path - Name Doesnt Exists \n"; exit(); } }

Thanks a lot... i will follow your suggestion and hope i can ask doubt regarding this..
Regards,
Suresh

In reply to Re^2: Read the values from a file by Anonymous Monk
in thread Read the values from a file by Anonymous Monk

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.