title: Split Perl string by full stop and use the elements as variables
body: <p>I have a string which is separated by full stops and I want to use the separated elements as variables.</p>
  
  <p>For example, if I have</p>
  
  <pre><code>$string = "This.is.a.string";
  </code></pre>
  
  <p>When I say</p>
  
  <pre><code>print $1;
  </code></pre>
  
  <p>I want this to output "This", or print $2 will output "is", etc.</p>
  
  <p>I have tried</p>
  
  <pre><code>$elements = split(/\\./, $string);
  print $1;
  </code></pre>
  
  <p>but no luck so far.</p>
  
  <p>Does anyone have any ideas how to do this?</p>