title: Using variables from a config/properties file in a perl script
body: <p>If I have a page of configurable variables separate from my perl script, how can I use them in it?</p>
  
  <p>Say I have these variables in the file.. </p>
  
  <pre><code>database.properties:
  
      database = "dbi:Oracle:host=host-321;sid=XE;port=1337","User","Passwd"
  
      table1 = CHANNEL
  
      table2 = NODE
  </code></pre>
  
  <p>...and I need them for these parts of my perl script:</p>
  
  <pre><code>my $dbh = DBI-&gt;connect($database);
  
  open ROW,"&gt;","./report/archive/rprt-$now/row_counts.txt" or die "Unable to create file: $!";
      my $chanRows = $dbh-&gt;selectrow_array("SELECT COUNT(*) FROM $table1");
      my $nodeElemsRows = $dbh-&gt;selectrow_array("SELECT COUNT(*) FROM $table2 WHERE NODE_TYPE &gt; 1");
      my $nodeDeviceRows = $dbh-&gt;selectrow_array("SELECT COUNT(*) FROM $table2 WHERE NODE_TYPE = 1");
      print ROW "Channels: $chanRows\n";
      print ROW "Network Elements: $nodeElemsRows\n";
      print ROW "Devices: $nodeDeviceRows";
  close ROW;
  </code></pre>
  
  <p>Obviously just simply putting $database, $table1 and $table2 in there like that won't do any good, so what is the right way to go about this? Thanks in advance.</p>