I am making a program like this and i know this a wrong program.But i try to understand you actually what i want. My progrm reads a config file and stores the data in an array. What i actually want is that if user give the To header field in the config file then it will assign it in the variable $to and otherwise it will call a sub routine for default To header field and store it in the variable $to. If user give the From header field in the config file then it will assign it in the variable $from. otherwise it will call a sub routine for default From header field and store it in the variable $from.Likewise there are many headers to be checked.Plz, suggest me some suitable code for it???
my $i=0; my ($to, $from); for(;;) { if (not exists $need[$i]) { last; } if($need[$i] =~ /To:/) { $to = $need[$i]; } else { $to = Header::To(); } if($need[$i] =~ /From:/) { $from = $need[$i]; } else { $from=Header::From(); } $i++; }

2006-09-07 Retitled by planetscape, as per Monastery guidelines

( keep:1 edit:23 reap:0 )

Original title: 'Suggest me some suitable code for it???'


In reply to Config file default options? by sanjay nayak

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.