title: Perl - how to get values of tokens
body: <p>I am searching how to get tokens values in properties file with Perl.</p>
  
  <p>Given the source property:</p>
  
  <pre><code>my $source="application.1.hostname={{DNS_APP}}:{{PORT_APP}}/WHATEVER";
  </code></pre>
  
  <p>And given the target property:</p>
  
  <pre><code>my $target="application.1.hostname=test.test.com:8080/WHATEVER";
  </code></pre>
  
  <p>I would like to get the following result:</p>
  
  <pre><code>{{DNS_APP}}=test.test.com
  {{PORT_APP}}=8080
  </code></pre>
  
  <p>I have no trouble to get the tokens with :</p>
  
  <pre><code>my @matches= ( $source =~ /({{.*?}})/g );
  </code></pre>
  
  <p>But then, how to match with their values ?
  Is there an easy way, with perl regexps to get these substitutions ?</p>
  
  <p>Another difficulty (but they are execption, so it is not a big deal if this problem is not addressed) is that, sometimes, $target can be</p>
  
  <pre><code>my $target="application.1.hostname=test.test.com/WHATEVER";
  </code></pre>
  
  <p>Or</p>
  
  <pre><code>my $target="application.1.hostname=test.test.com:8080/SOMETHINGELSE";
  </code></pre>
  
  <p>Or even</p>
  
  <pre><code>my $target="application.1.hostname=test.test.com/SOMETHINGELSE";
  </code></pre>
  
  <p>How to deal with that ?</p>
  
  <p>I thank you in advance for you answers.</p>
  
  <p>Regards.</p>