use strict; use warnings; use Config::Tiny; my $DATA =<<EOT localusername=me ip=36.212.176.90 port=5060 remotename=you ip=36.212.176.92 port=5060 transport=udp EOT ; # Create a config my $Config = Config::Tiny->new(); # Open the config, replace with read and $DATA with filename $Config = Config::Tiny->read_string( $DATA ); #$Config = Config::Tiny->read( $filename ); # see perldoc Config::Tiny my $s = $Config->{_}; # I was to lazy to finish this: my $INVITE = join(' ', 'INVITE sip:' . $s->{remotename} .'@'. $s->{ip} +, 'SIP/2.0 Via:SIP/2.0/UDP', $s->{localusername} +. '@' . $s->{ip} .':5060', 'From:sam<sip:me@36.212.176.92>', 'To: you<sip:you@36.212.176.90>', ); print $INVITE;
UPDATE: You probably want to add a [local] and a [remote] section in the config file. Then just access the variables with $r = Config->{remote} and build your INVITE line. See perldoc Config::Tiny.

In reply to Re: Read the config file and create the INVITE line as per config file by lima1
in thread Read the config file and create the INVITE line as per config file by samirpatry

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.