title: Perl hostname regular expression
body: <p>I have the following snippet code:</p>
  
  <pre><code>my $hostname =  `host \`hostname\``;
  </code></pre>
  
  <p>which this yields something like :</p>
  
  <p><code>blahblah.test1234.mydomain.com has address 12.345.67.8910</code>  (I replaced the real values with dummy values)</p>
  
  <p>from here, I want to extract this so that <code>$hostname</code> only has "<code>blahblah.test1234.mydomain.com</code>" and forget the rest</p>
  
  <p>Such piece of code will be ran in different servers so the size of this can vary.</p>
  
  <p>I was thinking using a regular expression that will be cut from the beginning of the line up to <code>mydomain.com</code>   so basically <code>*.mydomain.com</code></p>